TOC and HTML tag

In a post, I want to use the HTML tag like the following:

<h1 style="text-align: center;">Test</h1>

I see the content (in this case ‘Test’) in the TOC but clicking on it doesn’t work.
I use the PaperMod theme, and the toc.html is here: hugo-PaperMod/toc.html at master · adityatelange/hugo-PaperMod · GitHub

It works if I use the Markdown tag like # Test.
Is there anything I miss?

I’d stick with markdown:

### My Heading {style="text-align: center;"}

If you need to use HTML, I imagine your theme’s TOC partial needs an element id…

<h1 id="something" style="text-align: center;">Test</h1>

Please take this up with the theme author if you have further problems:
https://github.com/adityatelange/hugo-PaperMod/

1 Like

It works!
Thank you very much @jmooring

1 Like

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