Is it possible to render uncited footnotes/references?

I use footnotes extensively in my writing. However, sometimes I’d like to add additional sources that I don’t directly reference. For example:

# Content
something [^a]

something else [^c]

# Footnotes

[^a]: one
[^b]: two
[^c]: three

In the standard format this will only render “a” and “c” but won’t list “b” at all. Is it possible to get this to be rendered even though there is no direct reference to it?

No, there is no footnote template. Is it for things like scientific references ? If so, you might want to hack the link renderhook instead. So that it doesn’t display anything but store references in a variable to be displayed at the end of the article.

Precisely. It is for documents I think that are worth reading or that I read in the background but that I don’t specifically cite.

interesting. Can you give me a pointer as to how I might do that? I’m fairly new to these sorts of things. I don’t want to break referenced links though.

Perhaps adding a new shortcode that adds an unreferenced citation might also be a good idea?

I thought about trying to use a shortcode with display:none - but this will add a backreference in the ultimate display.

You could… But I’d rather avoid such heavy handed practices and ruin an otherwise beautiful and light markdown syntax !
Look at that:

{{- $destination := .Destination -}}
{{- if eq $destination "ADD_REF" -}}
{{- warnf "Missing reference for link [%s](%s) in page %s" (.Text|htmlUnescape) $destination .Page.Path -}}
{{- .Text -}}
{{- else if eq $destination "#"}}<ins>{{- .Text -}}</ins>
{{- else if eq $destination "ABBR" -}}<abbr {{with .Title -}}tooltip="{{.}}"{{- end -}} role="term">{{- .Text -}}</abbr>{{- else if eq $destination "DFN" -}}<dfn {{with .Title -}}tooltip="{{.}}"{{- end -}}>{{.Text}}</dfn>
{{else}}{{- $isRemote := and (not (strings.HasPrefix $destination ".")) (strings.Contains $destination ".") -}} {{- if $isRemote -}} {{- .Page.Store.SetInMap "all_sources" .Destination (default .Text .Title) -}} {{- if not (strings.Contains $destination "://") -}} {{- $destination = print "https://" $destination -}} {{- end -}} {{- else -}} {{- $url := urls.Parse .Destination -}}{{- $page := .Page.GetPage $url.Path -}} {{- $fragment := $url.Fragment -}}{{- if $page -}}{{- $destination = $page.RelPermalink -}} {{- with $fragment -}} {{- $destination = print $destination "#" $fragment -}} {{- end -}} {{- else -}} {{with resources.Get .Destination}}{{- $destination = .RelPermalink}}{{end}} {{- end -}} {{- end -}} <a {{with .Title}}tooltip="{{.|$.Page.RenderString}}"{{end}} href="{{- $destination -}}"{{if $isRemote}} rel="external nofollow" target="_blank"{{- end -}}>{{- .Text|safeHTML -}}</a> {{- end -}} 

If you want to add references, just make a new else if eq $destination "undisplayed_refs" branch or something to that effect. You would use it like this:

[The Noah Myth in Twenty-First-Century Cli-Fi Novels, Rewritings from a Drowning World, by Helen E. Mundler](undisplayed_refs)

I think I understand the intended goal of the above snippet - but I’m not entirely certain of how to integrate it.

If I look at the default render-link.html (./tpl/tplimpl/embedded/templates/_default/_markup/render-link.html) I don’t see anything that resembles the above. Ditto in my chosen theme (presently mainroad).

Or is the idea that this acts as additional transformation on top of the default? If so, why do I need to handle anything but undisplayed_refs ?

I’ve been reading Render hooks | Hugo and Link render hooks | Hugo but don’t feel like I have a great handle on how this ought to work.

(this would be my first render hook so I’m still trying to understand the basics)

I would not go for footnotes without backreference due to user expectations and the definition of footnotes.

footnotes (in most cases) are explanatory, additional information for the marked text. They are extracted to a footnote to encance reading experients – usually you don’t have to read it.

If one jumps from text to it’s footnote users expect to get beck to the place in the text where they came from.

If one jumps to footnote “a” and sees a second one below “b” one would expect that one can jump to the place in the text, where the note is referenced… non backlinked footnotes will break that.

usually additional page level documents are listed under something like “further readings”, “references” , …

if you really want it I would go with two shortecodes

  • one to define the link and anchor

    {{ footnoteLink "1" }} or {{ footnote "TEXT" "1" }}

  • one for the text

    {{ footnoteText "1" }}
    markdown code here processed with .Inner and Render
    {{ /footNoteText }}
    

If your intention was to add more text to one footnote: Footnote[^1] Second[^2]

  1. Footnote explanation [backlink to 1]
    Here’s some more info you might be interesting:
  2. second footnote [backlink to 2]

you could do

[^1]:
    Some additional articles  about _Tempor_ you 

    - this [One](link1)

    - and that [Two](link2)

[^2]: [Typesetting test text](http://lorem.ipsum.org)

if you don’t like the backlink at the end or the whole note, you are at option one :wink:

1 Like

The problem here is that it looks worse, and you can’t get consistent numbering. For example See


FWIW I really wish there was a separation between footnotes and citations and that both had more flexibility overall:

  • the ability to customise the text of the note.
  • the ability to add prefix or postfix information to the note
  • subnotes (i.e., one reference, but different pages)
  • ideally loading some references from a bittex file

what I want it probably sufficient to need an entire hugo extension of some sort (I don’t know the terminology yet) but is a bit off topic from this thread.

Keep in mind that footnote rendering already is an extension but for goldmark. I wouldn’t suppose that such a thing will be implemented by Hugo core. Merging non footnotes into the footnotes with numbering and turn off backlinking — guess that won’t happen in either goldmark or hugo.

As I said two different things. - To much hassle to implement for a at least unconvenient feature and unexpected result for the reader.

I would keep that separately: a document section with the references and a footnote at the end.

rename and styling may improve a lot (maybe number with a, b,c )

Fair. It’ll be interesting if I ever have both textual footnotes and referenced citations, but what you suggest may be good enough for now.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.