Footnotes as Sidenotes

Write ordinary Markdown footnotes, read them in the margin

Footnotes are the most portable way to write a note in Markdown: every editor previews them, every converter understands them, and they survive a move to another blog engine.CommonMark has no footnotes, but GitHub, Pandoc, MultiMarkdown, Obsidian and Goldmark all accept the same [^label] syntax. Sidenotes are the better way to read a note. This theme lets you write the first and publish the second.

How it works

Hugo renders footnotes as a superscript link in the text and a numbered list at the end of the page.Footnotes come from Goldmark’s footnote extension, which Hugo enables by default. After Hugo has rendered the page, the theme rewrites that output: each reference becomes the label, checkbox and span.sidenote that Tufte CSS expects, the note text is moved next to its reference, and the list at the bottom is removed.

Nothing changes in your source. This paragraph, for example, is written as

Hugo renders footnotes as a superscript link in the text
and a numbered list at the end of the page.[^goldmark]

[^goldmark]: Footnotes come from Goldmark's *footnote*
    extension, which Hugo enables by default.

and the note appears in the margin, numbered automatically by Tufte CSS’s counter.

What a footnote may contain

Notes are rendered as inline text inside a span, so they can hold anything that fits in a sentence: emphasis, strong text, code, and links.For example, a link to the Tufte CSS repository, some inline code and a word in italics. Paragraph breaks inside a long footnote are kept as line breaks.This is the first paragraph of a long note.
This is its second paragraph, indented by four spaces in the source. In the margin it starts on a new line.

Footnote labels do not have to be numbers. Words make the source easier to read,This note is labelled [^words] in the source. and the theme handles both kinds of label the same way. The number displayed is always the position of the note on the page, not its label.

A footnote can be referenced more than once.This note is referenced twice in the paragraph, and appears next to each reference. Each reference gets its own sidenote, so the reader never has to look for the first one.This note is referenced twice in the paragraph, and appears next to each reference.

Footnotes on list pages

Summaries on the home page and on section pages go through the same conversion, and every note gets an identifier derived from the page’s permalink and a counter. Two posts shown on the same list page therefore never fight over the same checkbox.

Sidenotes and real footnotes together

Some notes belong in the margin, others below the text: a proof, a long digression, a licence notice. The theme lets a page mix both, with four ways of writing a note:

You writeYou get
{{< sidenote >}}…{{< /sidenote >}}always a sidenote
{{< footnote >}}…{{< /footnote >}}always a real footnote
[^label]a sidenote in sidenotes mode (the default), a real footnote in endnotes mode
[^fn-label] in sidenotes mode, [^sn-label] in endnotes modethe other kind

This paragraph uses all four. A sidenote written with the shortcode,This one comes from the sidenote shortcode. a Markdown footnote that becomes a sidenote,This note is written [^margin], so it goes to the margin like every Markdown footnote on this page. a Markdown footnote kept as a real footnote thanks to its fn- prefix,a and a real footnote written with the shortcode.b

The two kinds are numbered independently. Sidenotes keep Tufte CSS’s arabic counter; footnotes get letters (a, b, …) whenever the page also has numbered sidenotes, so a reader never confuses the two sequences (footnotestyle chooses arabic, alpha, roman or LaTeX’s symbols *, †, ‡ instead). The footnote list goes at the end of the article; with footnoteplacement: section each section gets its own list, the closest the web comes to the bottom of a printed page. The post Footnotes and Sidenotes shows that placement.

Opting out

Set footnotes = "endnotes" in the [params] of your site configuration to keep Hugo’s ordinary footnote list everywhere, or set it in the front matter of a single page:

---
title: "A page with endnotes"
footnotes: endnotes
---

In that mode [^sn-label] still gives a sidenote. The post Small Multiples on this site uses endnotes.

For notes that should not be numbered, use the marginnote shortcode instead:This is a margin note, written with the marginnote shortcode. It has no number; on small screens it hides behind the ⊕ symbol. there is no Markdown syntax for an unnumbered note.


  1. This note is written [^fn-below]. The fn- prefix keeps it a real footnote, listed below the text.

    A real footnote may have several paragraphs: the list is block content, unlike a sidenote. ↩︎

  2. This one comes from the footnote shortcode. Like every real footnote it is listed below the text, with a link back here. ↩︎