Skip to content

rdavydov/blog

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logic & Trick Blog

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.

Routes

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

Project Structure

  • index.php: Bootstrapping, routing, processing, and main page template
  • .htaccess: Requires mod_rewrite to work
  • generate-post-data.py: Python 2 script that generates the BlogData.php file
  • php
    • BlogData.php: Cached post database. Generated by generate-post-data.py
    • DataAccess.php: Thin wrapper around the BlogData database
    • Templates.php: Some basic HTML templating functions
    • Parsedown.php and ParsedownExtra.php: MIT licensed Markdown parsing library. See here for more info
  • img: Images
  • css: Styles
    • normalize.css: MIT licensed CSS library. See here for more info
  • posts: Posts go here. File names should be URL-safe and have extension .md

License

About

My personal blog.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 90.7%
  • CSS 7.4%
  • Python 1.9%