[buug] OT: Blog compiler that uses relative paths

Ian Zimmerman itz at buug.org
Tue Jan 14 22:26:57 PST 2014


This is off topic but I figure I have a better chance to have this
answered here (if there is a good answer).

I am looking for a static blog compiler/renderer.  That is, for a
program that takes a bunch of text files (maybe written in rst, markdown
or something like that) and produces a tree of html and css files with
the structure of a blog (split into years, months, days, categories and
what not).  Really any static website generator, as the blog structure
is just a special case.

So far, I have looked at mnemosyne [1] and pyblosxom [2].  More than
looked, I tried to use them.  Unfortunately, they both employ the
following pattern (or antipattern, as it seems to me):

In a config file:

blah blah blah
foo bar
...
base_url = http://my.domain.org/~itz/blog
...

In a template file, called something like html.template:

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" href="$(base_url)/default.css" type="text/css" />
    ...
  </head>
  <body>
  $(content)
  </body>
</html>

and then the rendering program fills the template and puts this into the
head of _every_ html file in the resulting structure, regardless of how
many levels deep:

    <link rel="stylesheet" href="http://my.domain.org/~itz/blog/default.css" type="text/css" />

This means I cannot test the look of the generated site by browsing it
locally, before I upload it to the webserver.  Which kind of defeats the
point of a static generator.

To me, a site compiler worth the name is at least smart enough to do
this:

html files in top level directory -
    <link rel="stylesheet" href="default.css" type="text/css" />

html files in 1st level subdirectory -
    <link rel="stylesheet" href="../default.css" type="text/css" />

html files in 2nd level subdirectory -
    <link rel="stylesheet" href="../../default.css" type="text/css" />

etc.

And the stylesheet is just the most obvious, most prominent example.
The same should be done with all internal links (and neither of the
packages I tried does it).

Does anyone know of a prgram that would help me?

[1]
http://www.red-bean.com/decklin/mnemosyne/

[2]
http://pyblosxom.github.io/

-- 
Please *no* private copies of mailing list or newsgroup messages.

gpg public key: 2048R/984A8AE4
fingerprint: 7953 ADA1 0E8E AB57 FB79  FFD2 360A 88B2 984A 8AE4
Funny pic: http://bit.ly/ZNE2MX


More information about the buug mailing list