upvote
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.

reply
Sure, here's the Makefile. Also, if you want more examples of working Hakyll setups, there's a long list of them here: https://jaspervdj.be/hakyll/examples.html

    # Binary tool we use to build the website.
    bins = dist-newstyle/build/*/*/*/*/site/build/site
    tool = $(bins)/site

    # By default, we build everything if you invoke `make` without a target.
    all: build
    .PHONY: all

    # The tool used to build the site is a Hakyll binary configured by `site.hs`.
    # This rule automatically builds the tool if it's out of date.
    $(tool): site.hs site.cabal
            cabal v2-build

    # The `build` target builds the web site's out-of-date static assets.
    .PHONY: build
    build: $(tool) pdfs
            $(tool) build

    # The `rebuild` target forces a rebuild of all web assets.
    .PHONY: rebuild
    rebuild: $(tool)
            $(tool) rebuild

    # This `push` rule publishes the static site to our CDN (firebase).
    # It requires:
    #
    # - the `firebase` tool:
    #   wget -O ~/bin/firebase https://firebase.tools/bin/linux/latest \
    #       && chmod +x ~/bin/firebase
    #   # Docs: https://firebase.google.com/docs/cli#linux
    #
    # - `firebase login --no-localhost` to have been run.
    #
    # You may need to run `firebase login --no-localhost --reauth` if
    # the local authentical credentials time out.
    .PHONY: push
    push: build
            firebase deploy --only hosting

    # Generate PDF versions of selected blog posts.
    .PHONY: pdfs
    pdfs: images/public_html/blog/pix-20240601/sampling-with-sql.pdf

    images/public_html/blog/pix-20240601/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 ../$@.tmp --pdf-engine=pdflatex ../$< && mv -f ../$@.tmp ../$@ )
reply