Просмотр файла htmly-2.9.8/README.md

Размер файла: 8.61Kb
  1. <a href="https://www.htmly.com" target="_blank">![Logo](https://raw.githubusercontent.com/danpros/htmly/master/system/resources/images/logo-big.png)</a>
  2.  
  3. HTMLy is an open source databaseless blogging platform prioritizes simplicity and speed written in PHP.
  4.  
  5. It uses a unique algorithm to find or list any content based on date, type, category, tag, or author, and it's performance remain fast even if we have ten thousand of posts and hundreds of tags.
  6.  
  7. Requirements
  8. ------------
  9. HTMLy requires PHP 5.3 or greater, PHP-XML package, PHP-INTL package, and PHP-ZIP package for backup feature.
  10.  
  11. Installations
  12. -------------
  13.  
  14. Install HTMLy using the source code:
  15.  
  16. 1. Download the latest version from the [Github repo](https://github.com/danpros/htmly/releases/latest)
  17. 2. Upload and extract the zip file to your web server. You can upload it in the root directory, or in subdirectory such as `htmly`.
  18. 3. Visit your domain. If you extract it in root directory visit `https://www.example.com/install.php` and if in subdirectory visit `https://www.example.com/htmly/install.php`.
  19. 4. Follow the installer to install HTMLy.
  20. 5. The installer will try to delete itself. Please delete the installer manually if the `install.php` still exist.
  21. **Note:** If you don't need to log in to the dashboard, just rename `config.ini.example` to `config.ini`, delete `install.php`, and you are set. It's always good practice to set the `site.url`
  22. ### Online install
  23.  
  24. Install HTMLy without downloading the source code and use the online installer:
  25.  
  26. 1. Download `online-installer.php` from the [latest release](https://github.com/danpros/htmly/releases/latest)
  27. 2. If you upload it in root directory visit `https://www.example.com/online-installer.php` or if in subdirectory visit `https://www.example.com/subdirectory/online-installer.php`.
  28. 3. Follow the installer to install HTMLy.
  29. 4. Please delete the installer manually if the `online-installer.php` and `install.php` still exist.
  30.  
  31. Configurations
  32. --------------
  33. Set written permission for the `cache` and `content` directories.
  34.  
  35. Users assigned with the admin role can edit/delete all users posts.
  36.  
  37. To access the admin panel, add `/login` to the end of your site's URL.
  38. e.g. `www.yoursite.com/login`
  39.  
  40.  
  41. Content Structure
  42. ----------------------
  43.  
  44. Like traditional static pages, even though HTMLy is a dynamic PHP application, most important metadata such as username, category, type, tags, publication date, and slug are in the folder name and filename.
  45.  
  46. If you use the dashboard to write your posts, the folder structure and filenames will be set by the dashboard automatically.
  47.  
  48. The following is an example of a folder and file structure from HTMLy:
  49.  
  50. ```html
  51. content/my-username/blog/my-category/post/2024-01-10-15-35-45_tag1,tag2_my-post-slug.md
  52. ```
  53. Here's the explanation:
  54.  
  55. * `my-username` is the username.
  56. * `my-category` is the content category.
  57. * `post` is the content type. Available content type `post`, `video`, `audio`, `link`, `quote`.
  58. * `2024-01-10-15-35-45` is the published date. The date format is `Y-m-d-H-i-s`
  59. * `tag1,tag2` are the tags, separated by commas
  60. * `my-post-slug` is the URL
  61.  
  62. **Note:** the filename metadata (post date, tags, slug) separated by an underscore.
  63.  
  64. With a structure like above, the post can now be visited even though it's just a folder structure and filename.
  65.  
  66. To claim this content or log in to dashboard, simply create `my-username.ini` in the `config/users/` folder (see `username.ini.example`).
  67.  
  68. ```cfg
  69. ;Password
  70. password = yourpassword
  71.  
  72. ;Encryption: Set to clear, and later it will changed to password_hash automatically during login
  73. encryption = clear
  74.  
  75. ;Role
  76. role = admin
  77. ```
  78.  
  79. And to add information about the author, create `author.md` in `content/my-username/`, example:
  80.  
  81. ```html
  82. <!--t My Cool Name t-->
  83.  
  84. Just another HTMLy user
  85. ```
  86.  
  87. Information about `my-category` can be added by creating `my-category.md` inside the `content/data/category/` folder.
  88.  
  89. ```html
  90. <!--t My category title t-->
  91. <!--d My category meta description d-->
  92.  
  93. This is my category info etc.
  94. ```
  95.  
  96. **Note:** The default category is `Uncategorized` with slug `uncategorized` and you do not need to creating it inside `content/data/category/` folder.
  97.  
  98. **Note:** Delete the `page` folder inside the `cache` folder to clear the html page cache served to visitors.
  99.  
  100. **Important:** Every time new content added (post, pages, category), or you make changes that change the folder structure or filenames, simply delete the `index` and `widget` folder inside `cache` folder so that the changes detected by HTMLy.
  101.  
  102. **Post Views limitations:** HTMLy using the post/page slug for the post/page views counter ID. So if you edit a post/page slug without using the dashboard, then you must edit `views.json` in the `content/data/` folder manually to update to the correct slug.
  103.  
  104. Static pages
  105. ------------
  106.  
  107. For static pages, use the following format:
  108.  
  109. ```html
  110. content/static/about.md
  111. ```
  112.  
  113. In the example above, the `about.md` creates the URL: `www.yourblog.com/about`
  114.  
  115. Thus, if you write/create files locally, you must name the .md file in the format above.
  116.  
  117. For static subpages, use the following format:
  118.  
  119. ```html
  120. content/static/about/me.md
  121. ```
  122.  
  123. This will create the URL: `www.yourblog.com/about/me`
  124.  
  125. An example pages/subpages content looks like:
  126.  
  127. ```html
  128. <!--t My page title t-->
  129. <!--d My page meta description d-->
  130.  
  131. This is my page info etc.
  132. ```
  133.  
  134. **Page ordering**
  135.  
  136. To sort the pages, you just need to add integer value followed by a period.
  137.  
  138. ```html
  139. content/static/01.contact.md
  140. content/static/02.about.md
  141. ```
  142.  
  143. For static subpages:
  144.  
  145. ```html
  146. content/static/01.contact/01.us.md
  147. content/static/01.contact/02.me.md
  148. ```
  149.  
  150. Content Tags
  151. -------------
  152. If you are writing locally, you need specify the content tags below:
  153.  
  154. **Title**
  155. ```html
  156. <!--t Title t-->
  157. ````
  158.  
  159. **Meta description**
  160. ```html
  161. <!--d The meta description d-->
  162. ````
  163.  
  164. **Tags**
  165.  
  166. This is just the tags display and for the slug is in the filename.
  167. ```html
  168. <!--tag Tag1,Tag2 tag-->
  169. ````
  170.  
  171. **Featured image**
  172.  
  173. Post with featured image.
  174. ```html
  175. <!--image http://www.example.com/image-url/image.jpg image-->
  176. ````
  177.  
  178. **Featured youtube video**
  179.  
  180. Post with featured youtube video.
  181. ```html
  182. <!--video https://www.youtube.com/watch?v=xxxxxxx video-->
  183. ````
  184.  
  185. **Featured soundcloud audio**
  186.  
  187. Post with featured soundcloud audio.
  188. ```html
  189. <!--audio https://soundcloud.com/xxxx/audio-url audio-->
  190. ````
  191.  
  192. **Featured link**
  193.  
  194. Post with featured link.
  195. ```html
  196. <!--link https://github.com/danpros/htmly link-->
  197. ````
  198.  
  199. **Featured quote**
  200.  
  201. Post with featured quote.
  202. ```html
  203. <!--quote Premature Optimization is The Root of All Evil quote-->
  204. ````
  205.  
  206. **Example**
  207.  
  208. Example of how your post would look like:
  209. ```html
  210. <!--t Here is the post title t-->
  211. <!--d The meta description d-->
  212. <!--tag Tag1,Tag2 tag-->
  213. <!--video https://www.youtube.com/watch?v=xxxxxxx video-->
  214.  
  215. Paragraph 1
  216.  
  217. Paragraph 2 etc.
  218. ```
  219.  
  220. ### Lighttpd
  221. The following is an example configuration for lighttpd:
  222.  
  223. ````php
  224. $HTTP["url"] =~ "^/config" {
  225. url.access-deny = ( "" )
  226. }
  227. $HTTP["url"] =~ "^/system/includes" {
  228. url.access-deny = ( "" )
  229. }
  230. $HTTP["url"] =~ "^/system/admin/views" {
  231. url.access-deny = ( "" )
  232. }
  233.  
  234. url.rewrite-once = (
  235. "^/(themes|system|vendor)/(.*)" => "$0",
  236. "^/(.*\.php)" => "$0",
  237.  
  238. # Everything else is handles by htmly
  239. "^/(.*)$" => "/index.php/$1"
  240. )
  241. ````
  242.  
  243. ### Nginx
  244. The following is a basic configuration for Nginx:
  245.  
  246. ````nginx
  247. server {
  248. listen 80;
  249.  
  250. server_name example.com www.example.com;
  251. root /usr/share/nginx/html;
  252.  
  253. access_log /var/log/nginx/access.log;
  254. error_log /var/log/nginx/error.log error;
  255.  
  256. index index.php;
  257.  
  258. location ~ /config/ {
  259. deny all;
  260. }
  261.  
  262. location / {
  263. try_files $uri $uri/ /index.php?$args;
  264. }
  265.  
  266. location ~ \.php$ {
  267. fastcgi_pass 127.0.0.1:9000;
  268. fastcgi_index index.php;
  269. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  270. include fastcgi_params;
  271. }
  272. }
  273. ````
  274.  
  275. Making a secure password
  276. ----------------------
  277. Passwords can be stored in `username.ini` (where "username" is the user's username) in either plaintext, encryption algorithms supported by php `hash` or bcrypt (recommended). To generate a bcrypt encrypted password:
  278. ````
  279. $ php -a
  280. > echo password_hash('desiredpassword', PASSWORD_BCRYPT);
  281. ````
  282. This will produce a hash which is to be placed in the `password` field in `username.ini`. Ensure that the `encryption` field is set to `password_hash`.
  283.  
  284. Contribute
  285. ----------
  286. 1. Fork and edit
  287. 2. Submit pull request for consideration
  288.  
  289. Contributors
  290. ----------
  291. - [HTMLy Contributors](https://github.com/danpros/htmly/graphs/contributors)
  292.  
  293. Copyright / License
  294. -------------------
  295. For copyright notice please read [COPYRIGHT.txt](https://github.com/danpros/htmly/blob/master/COPYRIGHT.txt). HTMLy is licensed under the GNU General Public License Version 2.0 (or later).