This is my simple static blog generator used for http://www.infectmac.com/. It is meant for me. But maybe someone else will find it of some use.
- Write posts in mardown and have code highlighted with pygments
- Generates individual posts as well as pages of posts
- RSS feed generation
generate.py- Program used to generate the blogsettings.py- configuration forgenerate.pyabout.markdown- File that will be rendered to{output}/about.htmlstatic/- js, css, and images used for the blogtemplates/- Templates used for the different pagesbase.html- Root template from which all others deriveabout.html- Template for rendered contents ofabout.markdownindex.html- Individual post or a list of posts. Results in files rendered to{output}/index.html, each{output}/pages/{n}.html, and each/posts/YEAR-MONTH-DAY-HOUR-MINUTE-Title-Here.htmlposts.html- List of all the posts the blog contains
The settings are specified with global variables in settings.py.
BLOG_URL- url to the root of the blog. Example:http://infectmac.com/OUTPUT_DIR- the directory that the blog will be emitted toPOSTS_PER_PAGE- Maximum number of posts that should be show on a single pageDEPLOY_CMD- The shell command that will be run from theOUTPUT_DIRin order to deploy the latest build. For example this could be:git add .; git commit -am "new post"; git pushTEST_OUTPUT_DIR- When thetestsubcommand is used theOUTPUT_DIRandDEPLOY_CMDare ignored. Instead the output is redirected toTEST_OUTPUT_DIR
generate.py has the following subcommands:
make- Generate the blog and output it to the directory specified insettings.py.new_post- Accepts a single argument for the title of the post. It will then create a file with the formatYEAR-MONTH-DAY-HOUR-MINUTE-Title-Here.markdownin theposts.test- The same as make but does not run the deploy command
The markdown files have extra variables that can be useful when linking to blog content. They are
{{image_path}}- relative path tostatic/img/{{posts_path}}- relative path toposts/{{static_path}}- relative path tostatic/
Example usage might be:  or
[link for file download]({{static_path}}files/download.zip)
Both variables will render as relative paths to either the image or static directory.
All images in a post will be linked to themselves by the ssbg.js.