stevenschobert.com
My flat-file blog, written in PHP and Markdown.
Adding Posts
Create a .md file with the following bit JSON at the top, and save it in the posts directory:
{
"title": "Post Title",
"date": "Aug 20, 2012",
"tags": ["github"]
}
--Simple and fast. One of the main perks of having a flat-file blog.
Configuration
Near the top of the index.php file, there’s some global settings that can be adjusted:
$blog = new Slim(array(
'view' => new TwigView(),
'posts.path' => './posts',
'md' => new dflydev\markdown\MarkdownParser(),
'pagination' => 5
));posts.path: The relative path to the directory that holds the Markdown postspagination: The number of posts that are show per-page
Note: the view and md are required and not customizable.
Theming
All the templates are built with Twig and are in the templates directory.
main.html: The core html template. All of the other templates extend this one. Contains all js/css links, headers & footers, etc.index.html: The home page template. Right now shows your blog index.post.html: The post view page, shows a single post.404.html: Custom 404 template.about.html: An about me pagetagged.html: The tag search template.pagination.html: The pagination template (partial) that shows on the bottom of the blog index.
Changing out styles is as easy as changing the <link> tag in the main.html template:
<link rel="stylesheet" href="/css/main.css" />More documentation on Twig is available here.
Advanced Customization
The whole blog engine is built on top of the Slim Framework. Stable documentation is available here.