Using Sphinx to write personal websites and blogs Using Sphinx to write personal websites and blogs python python

Using Sphinx to write personal websites and blogs


I've done it at http://reinout.vanrees.org/weblog. The key trick is to add a preprocessor step. I've got my blog entries in a weblog/yyyy/mm/dd/ folder structure.

A script iterates through that folder structure, creating index.txt files in every directory, listing the sub-items. The normal Sphinx process then renders those index.txt files.

I added a custom Sphinx processor for tags. So ".. tags:: python, buildout" somewhere at the top of my weblog entry generates the tags. And the preprocessor again collects those entries and writes out a weblog/tags/TAGNAME.txt file which Sphinx again renders normally.

The preprocessor also creates the root weblog/index.txt with the latest 10 entries. And an weblog/atom.xml in (hardcoded) the output directory for the rss feed.

So: you need some custom stuff, but it is pretty much plain text, so for me it was a nice exercise. And you get to write some helper scripts to make life easy, for instance one that copies a textfile from somewhere to today's weblog directory (including creation of missing directories and an "svn add").


As of now (February, 2012), there are different resources available to do what you want:

A blog engine based on sphinx: http://tinkerer.me/

Reinout Van Rees' blog: https://github.com/reinout/reinout.vanrees.org

The feed contrib extension: https://bitbucket.org/birkenfeld/sphinx-contrib/src/tip/feed/README


Doug hellmann, author of the 'Python Module of the Week' does his site using Sphinx.

http://www.doughellmann.com/PyMOTW/

He has several posts which cover sphinx topics that can probably help you on your way:

http://blog.doughellmann.com