Pages

Saturday, 1 February 2014

HTMLY-一个基于php的无需数据库的静态博客程序

HTMLy is an open source databaseless blogging platform prioritizing simplicity and speed.
You do not need to use a VPS to run HTMLy, fairly shared hosting or even a free hosting as long as those hosting already support at least PHP 5.3.

Features

  • Admin panel
  • Markdown editor with live preview
  • Categorization with tags (multi tags support)
  • Static pages Eg. for contact page
  • Meta canonical, description, and rich snippets for SEO
  • Pagination
  • Author page
  • Multi author support
  • Social links
  • Disqus Commenting System
  • Google Analytics
  • Built-in search
  • Related posts
  • Per post navigation (previous and next post)
  • Body class for easy theming
  • Breadcrumb
  • Archive page (by year, year-month, or year-month-day)
  • JSON API
  • OPML
  • RSS Feed
  • Sitemap.xml
  • Archive and tag cloud widget
  • SEO friendly URL
  • Teaser thumbnail for images and Youtube videos
  • Responsive design

Requirements

HTMLy requires PHP 5.3 or greater.

Installations

Download the latest version, extract it, then upload the extracted files to your server. Make sure the installation folder is writeable by your server.

Configurations

Change config.ini inside config folder, and than create YourUsername.ini inside config/users folder, write down your password there.
password = YourPassword
You can login to admin panel at www.example.com/login.

Both Online or Offline

In addition to using the built-in editor in the admin panel, you can also write it offline and then upload them into content/username/blog folder (the username must match with YourUsername.ini above).
For static pages you can upload it to content/static folder.

File Naming Convention

When you write a blog post and save it via the admin panel, HTMLy automatically create a .md file extension with the following name, example:
2014-01-31-12-56_tag1,tag2,tag3_databaseless-blogging-platform.md
Here's the explanation (separated by an underscore):
  • 2014-01-31-12-56 is the published date. The date format is yyyy-mm-dd-hh-mm
  • tag1,tag2,tag3 is the tag, separated by comma
  • databaseless-blogging-platform is the URL
For static pages, we use the following format:
about.md
That is means if about is the URL.
So if you write it offline then you must naming the .md file as above.

Content Title

If you write it offline, for the title of the post you need to add a title in the following format:
<!--t Here is the post title t-->

Paragraph 1

Paragraph 2 etc.
So wrap the title with HTML comment with t for both side.

Demo

Visit a real blog powered by HTMLy at Danlogs.

Credit

People who give references and inspiration for HTMLy:
from https://github.com/danpros/htmly
https://github.com/danpros/htmly/issues/353
https://github.com/danpros/htmly/issues/425
https://github.com/danpros/htmly/issues/106
(https://github.com/Kanti/htmly-installer)

注:还需启用nginx的重写功能,方法如下

Nginx does not support .htaccess files.

On CentOS Nginx stores virtual host files in /etc/nginx/conf.d. I assume you’re using the default.conf file. So edit this file and find the following:

location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm;
}

and make the following change:

location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm index.php;
    try_files $uri $uri/ /index.php?$args;
}

Save the file and reload Nginx。

from https://www.digitalocean.com/community/questions/enabling-nginx-mod_rewrite

关于没有html editor问题的解决

To create code blocks, indent every line of the block by at least four spaces or one tab.

    <html>
      <head>
      </head>
    </html>
详见https://www.markdownguide.org/basic-syntax/#code
https://github.com/danpros/htmly/issues/427
(http://domchristie.github.io/turndown/, 如何把html code转化为markdown code.
https://github.com/npc-network/translator-website )

相关帖子:https://briteming.blogspot.com/2014/06/linux-vpsphpphpmecha-cms.html