Citations

Jekyll (competitor) supports citations via Ruby gems

Using the above gem, a theme like just-the-docs allows referencing to the literature, and the list of cited references appears at the bottom of the page, releasing the author from the grunt work.

What is Hugo’s equivalent?

no buil in citation support. you could go with:

  • footnotes
  • shortcode
  • (blockquote render hook)

if you don’t need math support a passthru render hook may be an option.

there’s also a custom module dunno if it’s still alive.

just search for ‘citation’ - quite some topics with some approaches to do it

This has come up before, both in the context of Markdown and AsciiDoc content formats.

I am not recommending an approach, but I am curious about your needs.

  1. Are your citation data files in BibTex or CSL format?
  2. Do you have individual data files, or one data file with multiple citation records?
  3. Which of the citation reference styles do you use:

I use BibTex data files with custom citation style.

In markdown, citing is as easy as writing

{% cite [KEY] %}

At the end of the document, the following line takes care of writing the cited references in full:

{% bibliography --cited %}

Options so far

Review

  • Jekyll-scholar is kind enough to use the bibtex file, without conversions, and allows for numeric citations;
  • Hugo-cite comes with APA style only (no numeric citations);
  • Hugo-simple-cite comes with numeric citations;
  • Hugo-academic-cli is an out-of-date fork of academic-file-converter
  • Academic-file-converter just puts a whole data file into markdown: no selective citations and related reference list.

This reduces one’s options to hugo-simple-cite.

Review of hugo-simple-cite

  • It demands conversion from bib to json;
  • It does not use the data folder. This causes labour, as it expects a bib.json file in each content folder, namely the same file copied multiple times;
  • it is fragile: two md files on same folder, using the same citation, citation works on the index file, fails on the other with a shortcode error;
  • accepted IEEE entries: book, chapter, broadcast, article-journal, article, paper-conference, webpage.

just had pandoc reconed… no clue if it supports your nees or integrates with the rest markdown

https://gohugo.io/content-management/formats/#pandoc

https://github.com/gohugoio/hugo/pull/9953

This is another option:

AsciiDoc with bibtex support:

asciidoctor-bibtex depends on bibtex-ruby, citeproc-ruby and csl-styles:

Many options without actual solution.

We need a goldmark extension “citation”, similar to footnote:

Possible usage:

This is a Markdown example with footnotes [^1] [^2] and citations [@3] [@4].

[^1]: This is the first footnote.
This is the second line of the first footnote.

[^2]: This is the second footnote.

### References

@misc{3,
   author    = {Hugo and friends},
   title     = {Hugo release version 0.145.0},
   year      = {2024},
   publisher = {GitHub},
   url       = {https://github.com/gohugoio/hugo/releases},
}
 
@book{4,
   author  = {Atishay Jain},
   title   = {Hugo in action: Static sites and dynamic Jamstack apps},
   publisher = {Manning},
   year    = {2022},
}

This would be a minimal solution, where standard bibtex references are treated like footnotes. It would be far from a solution like Jekyll scholar, but still a minimal solution. The complete absence of a solution is not nice. Using Pandoc brakes themes, so it needs to be a goldmark estension with hugo shortcodes.

This is a Goldmark extension for bibtex:

Uses the bibtex file directly; no need for conversions.
Lacks the Hugo shortcodes.

Is it possible to add the goldmark extension goldmark-bibtex to Hugo without recompiling hugo?

Not part of hugo 0.145.0. Will it be in version 0.146.0?

No. It will not.