The main issue with old generated blog structure was difficulty to supplement articles with pictures and code. All generated posts were placed into the root, like:
post-608859f7-a1a7-449b-b0c4-d649942412b0.html
tag-emacs.html
feed-emacs.atom
Origin of such structure: when you have flat structure it is easy to navigate between HTML pages with relative links, no need to worry about base path.
During the design I chose to store a post meta in a separate file:
- when you support several formats (RST/MD) each have own syntax for meta information
- MD parser is greedy, you have to parse entire file just to extract title, to build archive widget you have to parse all files!
Another decision was also to keep summary/excerpt in a separate file, otherwise you face the same problems:
- delimited between post body and excerpt would be proprietary extension for each format
- you have to parse full article just to find excerpts (which are necessary for
index.html
meaning releasing all articles!)
New structure is documented and then implemented.
I chose to place each post into separate directory so images and code could be placed nearby and
referenced via relative path, like img/stats.png
or code/java/App.java
.
Other resources began to be stored structurally.
Together that made impossible to browse HTML pages using file:
protocol as I started to reference
to resources via absolute base path
, basically every href=
or src=
became like:
href="/css/main.css"
href="/post/about-java/post.html
href="/tag/posix.html"
src="/js/main.js"
So I had to set local Web server (Lighttpd) and point it to build directory to test blog generator.
Static blog generator Blog4u is not yet done, still it can convert:
- RST, Markdown, TXT files into blog pages
- with Atom feed support
- with summary/excerpts support
- with navigation though the posts in chronological order
Upcoming work for static blog generator Blog4u is:
- avoid file parsing if size/mtime haven't changed
- code highlighting for MD
- extension syntax for bundled images & code
For the blog itself I plan automate publishing a bit by setting hg
hook on push
.