forked from 20xd6/simple_blog
136 lines
7.5 KiB
Markdown
136 lines
7.5 KiB
Markdown
# simple_blog
|
|
|
|
simple_blog is a basic blogging platform. It is designed to be a straightforward way to publish articles written in Markdown and display them using a renderer written in PHP. There is no login page or any way to manage simple_blog from the web. All management is done via the command line. This can be done with a shell script or with the python based [simple_blog_cms](/git/20xd6/simple_blog_cms).
|
|
|
|
## Requirements
|
|
|
|
* Currently tested with PHP 7.4
|
|
* Some shell access is necessary.
|
|
* The recommend way is via ssh.
|
|
* I don't see a technical reason it can't work with a web manager like cPannel or Ajenti as long has you have the ability to upload files and manage files.
|
|
|
|
## Publishing
|
|
|
|
Publishing can be done manually or with a script that accomplishes the following tasks.
|
|
|
|
1. Create a directory under `/blog/by_year/$CURRENT_YEAR/$CURRENT_MONTH/`
|
|
* For a post in January of 2022 this would be `/blog/by_year/2022/01/`
|
|
* The directory should start with a numeral otherwise it will be sorted alphabetically
|
|
2. Place a file named `article.md` containing the MarkDown formatted text of the article in the directory created in the previous step
|
|
3. Copy or symlink `/common/index.php` into the directory created in step 1
|
|
4. Place a file named `tags` containing a comma separated list of tags for the article in the directory created in step 1
|
|
5. Add the article's relative path and title to `/by_tag/tags.csv` under the appropriate headings.
|
|
|
|
The recommended method is to use [simple_blog_cms](/git/20xd6/simple_blog_cms "simple_blog_cms")
|
|
|
|
## Article Tags
|
|
|
|
### Per-article List
|
|
|
|
A file named `tags` is placed in the directory for each article. It should contain a comma separated list of tags being applied to the article. This will be parsed and displayed by [`/common/md_read.php`](/git/20xd6/simple_blog/src/branch/master/common/md_read.php) at the bottom of the article.
|
|
|
|
### by_tags
|
|
|
|
This folder contains an index file that displays an article list generated by parsing the `tags.csv` file. A format example is displayed below.
|
|
|
|
| "PHP" | "JS" | "Religion" | "Catholic" |
|
|
| ----- | ---- | ---------- | ---------- |
|
|
| "/blog/by_year/2021/10/03_Forcing_Elements_to_reload/" | "/blog/by_year/2021/10/03_Forcing_Elements_to_reload/" |"/blog/by_year/2021/10/reproduction_of_Gainer_Bishop_Ronald_4-1-16/" | reproduction_of_Gainer_Bishop_Ronald_4-1-16/" |
|
|
| "Forcing page elements to reload" | "Forcing page elements to reload" | "Open Letter to Bishop Ronald Gainer" | "Open Letter to Bishop Ronald Gainer" |
|
|
| "/blog/by_year/2022/06/28_A_Test_Post/"| | |
|
|
| "A Test Post" | | |
|
|
|
|
## Authors
|
|
|
|
Post authors can be kept under `/blog/authors/`. Authors are kept in separate directories.
|
|
|
|
The authors directory is parsed by [`article.php`](/git/20xd6/simple_blog/src/commit/7734de9fa483257a90a658b74b78b47e4de716e2/common/php/article.php#L25) using a file named `author` from the post's directory. This file should contain a single line with the author's name.
|
|
|
|
## File Descriptions
|
|
|
|
### blog
|
|
|
|
Contains the blog articles. The articles are placed in subdirectories of `by_year` according to the year and month they were published.
|
|
|
|
```
|
|
├── by_year
|
|
│ ├── 2021
|
|
│ │ ├── 12
|
|
│ │ └── index.php -> /path/to/common/index.php
|
|
│ ├── 2022
|
|
│ │ ├── 01
|
|
│ │ ├── 02
|
|
│ │ └── index.php -> /path/to/common/index.php
|
|
│ └── index.php
|
|
└── index.php -> /path/to/common/index.php
|
|
```
|
|
|
|
### common
|
|
|
|
This directory contains the files and libraries used to render the site's pages.
|
|
|
|
#### Composer files
|
|
* composer.json
|
|
* composer.lock
|
|
* [/common/vendor]() - Stores the composer files and libraries managed via composer.
|
|
|
|
#### [CSS](/git/20xd6/simple_blog/src/branch/master/common/css)
|
|
|
|
* [styles.css](/git/20xd6/simple_blog/src/branch/master/common/css/styles.css) - The main site CSS.
|
|
* [jmenu.css](/git/20xd6/simple_blog/src/branch/master/common/css/jmenu.css) - Used to render the responsive menus.
|
|
* [print.css](/git/20xd6/simple_blog/src/branch/master/common/css/print.css) - Used to style printed pages.
|
|
|
|
#### [JS](/git/20xd6/simple_blog/src/branch/master/common/js)
|
|
|
|
* [page_format.js](/git/20xd6/simple_blog/src/branch/master/common/js/page_format.js) - The main JS file used for formatting and adding extra functions to pages.
|
|
|
|
#### [PHP](/git/20xd6/simple_blog/src/branch/master/common/php)
|
|
|
|
* [footer.php](/git/20xd6/simple_blog/src/branch/master/common/php/footer.php) - The common page footer. Contains copyright information and links to the license.
|
|
* [get_month_name.php](/git/20xd6/simple_blog/src/branch/master/common/php/get_month_name.php) - Translates a numeral month into the corresponding name. I.E. 01 into January.
|
|
* [h1_month.php](/git/20xd6/simple_blog/src/branch/master/common/php/h1_month.php) - Adds the proper `<h1>` heading based on the location of the
|
|
* [header.php](/git/20xd6/simple_blog/src/branch/master/common/php/header.php) - The common page header.
|
|
* [index.php](/git/20xd6/simple_blog/src/branch/master/common/php/index.php) - The index file used for most of the pages on the site.
|
|
* [markdown.php]()
|
|
* [md_read.php](/git/20xd6/simple_blog/src/branch/master/common/php/md_read.php) - Renders Markdown files and adds
|
|
* [menu.php](/git/20xd6/simple_blog/src/branch/master/common/php/menu.php) - Generates the blog menu items in the navigation menu.
|
|
* [modal.php](/git/20xd6/simple_blog/src/branch/master/common/php/modal.php) - Adds the modal `<div>` for displaying the image pop out.
|
|
* [page_menu.php](/git/20xd6/simple_blog/src/branch/master/common/php/page_menu.php) - Generates a menu from the files and directories where it's run from.
|
|
|
|
#### [/common/error_pages/](/git/20xd6/simple_blog/src/branch/master/common/error_pages)
|
|
|
|
* [403.php](/git/20xd6/simple_blog/src/branch/master/common/error_pages/403.php) - The 403 not allowed page.
|
|
* [404.php](/git/20xd6/simple_blog/src/branch/master/common/error_pages/404.php) - The 404 page.
|
|
* [500.php](/git/20xd6/simple_blog/src/branch/master/common/error_pages/500.php) - Displayed for all HTTP 500 errors
|
|
|
|
#### [/common/imgs/](/git/20xd6/simple_blog/src/branch/master/common/imgs)
|
|
|
|
Images used site wide.
|
|
|
|
* [cursor.gif](/git/20xd6/simple_blog/src/branch/master/common/imgs/cursor.gif) - Blinking cursor used on the front page.
|
|
* [icon-rss.png](/git/20xd6/simple_blog/src/branch/master/common/imgs/icon-rss.png) - RSS icon
|
|
|
|
|
|
#### [/common/prisim](/git/20xd6/simple_blog/src/branch/master/common/prisim)
|
|
|
|
Files for the prism syntax highlighter.
|
|
|
|
### license
|
|
|
|
This directory contains all the licensing information for simple_blog. simple_blog is licensed under the GPLv2 but uses components that are licensed under the MIT Open Source license. These components are:
|
|
|
|
* [Jmenu](https://github.com/jamesjohnson280/JMenu)
|
|
* [Parsedown](https://github.com/erusev/parsedown)
|
|
* [Parsedown-extra](https://github.com/erusev/parsedown-extra)
|
|
|
|
#### index.php
|
|
|
|
Displays all of the reverent license and the components they apply to.
|
|
|
|
* simple_blog is licensed GPLv2. This cannot be changed.
|
|
* Default license for articles published. This is [Creative Commons Attribution 3.0 Unported License](http://creativecommons.org/licenses/by/3.0/) by default. This licensed can be changed however the site admin wishes.
|
|
* [Jmenu](https://github.com/jamesjohnson280/JMenu) is licensed MIT. This cannot be changed.
|
|
* [Parsedown](https://github.com/erusev/parsedown) is licensed MIT. This cannot be changed.
|
|
* [Parsedown-extra](https://github.com/erusev/parsedown-extra) is licensed MIT. This cannot be changed.
|
|
|
|
Copies of all these licenses can be found in the `/license/` directory. |