# TOC and HTML tag

**URL:** <https://discourse.gohugo.io/t/toc-and-html-tag/37490>\
**Category:** support\
**Created:** [March 4, 2022, 3:46pm UTC](https://discourse.gohugo.io/t/toc-and-html-tag/37490 "2022-03-04T15:46:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicfab](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/nicfab/32/15818_2.png) [@nicfab](https://discourse.gohugo.io/u/nicfab)\
**Post date:** [March 4, 2022, 3:46pm UTC](https://discourse.gohugo.io/t/toc-and-html-tag/37490/1 "2022-03-04T15:46:44Z")

</div>

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](https://github.com/adityatelange/hugo-PaperMod/blob/master/layouts/partials/toc.html)

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

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [March 4, 2022, 4:00pm UTC](https://discourse.gohugo.io/t/toc-and-html-tag/37490/2 "2022-03-04T16:00:38Z")

</div>

I’d stick with markdown:

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

```

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

```nohighlight
<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/](https://github.com/adityatelange/hugo-PaperMod/)

---

<div class="post-metadata">

**Author:** ![nicfab](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/nicfab/32/15818_2.png) [@nicfab](https://discourse.gohugo.io/u/nicfab)\
**Post date:** [March 4, 2022, 4:03pm UTC](https://discourse.gohugo.io/t/toc-and-html-tag/37490/3 "2022-03-04T16:03:45Z")

</div>

> [@jmooring](#):
>
> `<h1 id="something" style="text-align: center;">Test</h1>`

It works!  
Thank you very much @jmooring

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [March 6, 2022, 4:04pm UTC](https://discourse.gohugo.io/t/toc-and-html-tag/37490/4 "2022-03-06T16:04:33Z")

</div>

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