Links inside the same content-file

Hi there,

I’m very new to Hugo, like most dudes asking simple questions here.

Is there a possibility to use some kind of label inside a content markdown file and link to that label from another position in the same file? I’m trying to link from my inline-citations to the full literature references at the end of the file, but can’t figure out how to do it.

I’ve some Markdown code like that. It works in VS Code, Github etc., but not at my Hugo test website:

# Heading

TextTextText. ([Trouillot \[1995\]


TextTextText. ([Ashton 2003](#ref-ashton_queens_egypt))

## Bib

<div id="refs" class="references csl-bib-body">

<div id="ref-ashton_queens_egypt" class="csl-entry">
Ashton, Sally-Ann. 2003. *The Last Queens of Egypt*. Harlow: Pearson.

<div id="ref-trouillot_silencing_the_past_2015">
Trouillot, Michel-Rolph. (1995) 2015. *Silencing the Past: Power and the Production of History*. Beacon Press.


Does anyone know if it is possible and, for the case it is, how to accomplish it? If the answer is very simple, I’m sorry for not searching long enough :wink:


What does this mean? What isn’t working?


sorry, maybe my explanations were a little bit confused.

I write in Latex or Pandoc-markdown referencing to my Bibtex file and convert it with Pandoc using citeproc and link-citations options/flags.

Unfortunatley, i didn’t found a solution which works with Hugo. Therefore, my general question is: if there exists a possibility to use some kind of label/id in the particular full reference at the end of the post (under the Bib Heading) wich i can link to from the short inline citations. So, that if someone who reads the post, can click the inline citation and will be directed to the full reference.

I hope that was clearer :wink:


You still haven’t answered my question. Telling us that it isn’t working is not helpful. We have no idea what isn’t working, how it is failing, etc. See Requesting Help.

In general…

Pure markdown

In your site configuration, enable markdown attributes for block level elements (blockquotes, fenced code blocks, headings, horizontal rules, lists, paragraphs, and tables).

title = true # default is true
block = true # default is false

Then in your markdown you can do:

This is a [link](#reference) to a block level element on the page.

This is the reference.

Markdown mixed with HTML

In your site configuration, allow HTML in content:

unsafe = true # default is false

This is safe if you control the content.

Then in your markdown you can do:

This is a [link](#reference) to a block level element on the page.

<div id="reference">
This is the reference.

Hi jmooring,

thanks for your detailed answer. The misunderstanding was my bad. In my mind it was clearer than in my words. What isn’t working: The post is rendered nicely in my browser, but if i click on an inline citation, which is also rendered as a link, nothing happens, that is: the cursor does not jump to the particular full reference at the end of the post. It does not show any error, just nothing happens.

But your suggestions sound like they should solve the problem. I’ll give you a report as soon as i’ve tried it later that evening.

Thank you

When you are testing, make sure there is enough content between the link and the target to cause the browser to scroll. If there’s not enough content, you won’t see any change.


i tried it and both ways work! Thanks @jmooring . For the moment i’ll stick with the unsafe option, because it’s what Pandoc offers me right now. But i’ll check the Pandoc options/flags, maybe it’s also possible to produce the pure Markdown output without editing the file afterwards.

But thats no Hugo related topic and my question is answered, thus the topic is solved.


1 Like

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