Hugo and Footnotes

hey, sometimes we all just need to write complicated things

Hugo does Markdown footnotes! Excellent. However, Hugo tends to assume you will never have more than one post with footnotes visible on a page, because Pretty Links.1 Awkward if you like multiple full posts on the homepage and you’re inordinately fond of footnotes like me. This is easily fixable! I had to spend some time figuring out how, so I’m putting the details here. (Current as of Hugo version 0.37.)

Footnote reference link styles are part of the Blackfriday Markdown engine internal to Hugo. They get adjusted in a separate blackfriday section in your site config file, using the plainIDAnchors setting. To turn off plain ID anchors, and have footnote reference links that reference the post ID as well as the footnote number, this needs to be in config.toml (in the root of your Hugo site directory):

plainIDAnchors = false

If you’re using config.yaml, it’ll be:

    plainIDAnchors: false

And then you should be able to put all the footnotes you want wherever you want.

  1. In other words, the default Hugo settings assume you’ll prefer short reference links that point to ‘fn:1’ rather than longer, more defined links that point to ‘fn:[long unique ID]:1’ [return]