This is my attempt at a super basic blog site without an SQL database attached.
Posts go in the posts
folder and must contain a JSON structure for metadata,
followed by a blank line, then the actual post in Markdown.
Example post file (the first completely blank line MUST be between the metadata and the content):
{
/* The following 4 fields are mandatory */
"date": "2015-01-01",
"category": "Examples",
"tags": [ "example", "post" ],
"title": "Example post"
/* Any additional metadata can be added here */
}
This is an example post. It's written in **Markdown**.
After changing anything inside the posts folder, execute generate-post-data.py
from the root directory to update the "database" stored in php/BlogData.php
.
The routing structure is very simple. Only two main routes are available:
/index
(or blank) - The index page/index/tag:{tag}
- Index page, filtering by tag/index/cat:{category}
- Index page, filtering by category
post/{id}
- The 'view post' page
index.php
: Bootstrapping, routing, processing, and main page template.htaccess
: Requires mod_rewrite to workgenerate-post-data.py
: Python 2 script that generates theBlogData.php
filephp
BlogData.php
: Cached post database. Generated bygenerate-post-data.py
DataAccess.php
: Thin wrapper around the BlogData databaseTemplates.php
: Some basic HTML templating functionsParsedown.php
andParsedownExtra.php
: MIT licensed Markdown parsing library. See here for more info
img
: Imagescss
: Stylesnormalize.css
: MIT licensed CSS library. See here for more info
posts
: Posts go here. File names should be URL-safe and have extension.md
- My blog posts inside the
posts
folder are CC-BY-NC-ND. - Everything else is MIT License