[go: up one dir, main page]

Skip to content

greghendershott/blog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is the source for my blog.

Although I developed – and still intend to maintain – Frog, I wanted to experiment with a different approach: Explode it into little pieces driven by a Makefile.

My Greenspun’s Tenth Rule riff: “Any sufficiently complicated static blog generator contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of make.” I can say that without being an asshole because I made one.

Premise: If you’re a programmer, your blog generator need not have configuration, customization, or templates. If you want it to work differently, you can change the code.

General

The heart of this is the Makefile.

As with Frog, this uses two-stage, “compile and link” metaphor.

“Compile”

  • Blog post source files $(src)/posts/*.md are “compiled” into $(cache)/*.rktd files. These files have some meta-data plus an xexpr representing the body of the post (e.g. the <article> element that will go in some containing page).
  • Each post tag appends the .rktd pathname to a $(cache)/tags/{tag-name}.

“Link”

  • Use $(cache)/*.rktd post bodies to generate complete .html post pages.
  • Use $(cache)/tags/{tag-name} to generate feeds and index page for each tag.
  • Generate $(src)/non-posts/*.md.
  • Generate sitemap.txt.
  • cp miscellaneous “assets” from $(src)/static/*.

Advantages

  • Changes to the overall page (e.g. updating a copyright in the footer) can be done without rebuilding the posts from scratch. This particularly helps when the posts are enhanced with things like syntax highlighting and automatic links to Racket docs, which take a bit longer to do.
  • As already mentioned, this allows a tags “database” to be made at the same time.

TO-DO

Maybe stop depending on frog/{enhance-body paths}

  • Split out from frog to new pkgs?
  • Also, the pygmentize stuff for frog spawns a long-running python process, which makes frog faster, but won’t help us (in fact it may hurt a little).

Maybe create new example repo named “tadpole”

  • With whatever is left after doing the previous item.
  • Replace my real src with some example content (e.g. from Frog).
  • Share as a repo (not a package) in case anyone else wants to fork it and do what they want.