Thanks. I do not have a public, detailed description of how my blog works. But in short, my site build system is powered by a Makefile that invokes Hakyll [1]. My Hakyll configuration has the following rule baked into it for generating HTML docs from Markdown docs in the `posts/` directory:
match "posts/*" $ do
route $ setExtension "html"
let ctx = postCtx tags
compile $ pandocMathCompiler
>>= loadAndApplyTemplate "templates/post.html" ctx
>>= saveSnapshot "content"
>>= loadAndApplyTemplate "templates/add-comments.html" ctx
>>= loadAndApplyTemplate "templates/default.html" ctx
>>= relativizeUrls
The `pandocMathCompiler` bit invokes Hakyll's Pandoc subsystem with support for rendering formulas using MathJax.The site Makefile also has rules to build PDF versions of the articles that I want to typeset. The rules just invoke Pandoc directly. For example, here's the rule used to generate the PDF file in my prior comment:
sampling-with-sql.pdf: posts/2024-08-23-sampling-with-sql.md
( cd posts && pandoc --metadata-file=../templates/latex-header-includes.yaml -t pdf -o ../[email protected] --pdf-engine=pdflatex ../$< && mv -f ../[email protected] ../$@ )
It's basically a straightforward invocation of Pandoc with a little shell boilerplate to prevent the PDF file from being moved into its final location unless Pandoc exits with success.The Makefile has a final "push" target that makes sure the site's assets are up to date (invoking Hakyll if needed) and then pushes the static site up to the content distribution network I'm using to publish my website.
Thank you so much!
Would you be willing to paste your entire Makefile here? Or are there secrets in it?
It would help me greatly — I don't have much experience with pandoc or hakyll. I understand the basics, but the actual usage in practice isn't so easy to set up from first principles.
I've been using Claude to help me with a lot of this, but I'm extremely curious to compare notes vs your setup.
If not, thank you anyway for your time.