TableOfContents "Academic" theme get only H1 and H2

Hi everyone, I deploy my website 1 month ago with “Academic Theme” and updated recently. It works fine, without problem on GitHub hosting.

I tried to implement TOC (Table of Contents) like as described on Academic Documentation, link is here:

and it get only Heading1 and Heading2, by shortcode directly on markdown post,
{{% toc %}}

I’m reading other files in themes folder, but I cannot to solve it. Only I saw these lines in academic.js

// Fix Hugo’s inbuilt Table of Contents.
_ $(’#TableOfContents > ul > li > ul’).unwrap().unwrap();_

Thanks for your help.


Can you share your git repo? This is hard to troubleshoot without seeing your code.

Yes sure.

This is a link to your theme’s repo. I meant your site’s repo.

Is the informational warning at the top of this page relevant:

And yeah, that javascript you cited? It looks like it removes parents so, there’s some interaction between that and the native hugo TOC code I would imagine. It might be fastest to talk to the theme author?

this one ?

Yes you are right. I saw only that forum for to discuss about it. Thank you.

Yes. Which blog post in particular are you having the issue with?

Hi, the post with TOC is this one.

Author’s theme said same thing. Hugo system take the variable .TableOfContent but get only H1 and H2, explained as comment above. So If I want to modify it, I cannot…isn’t it?

I see. Well, like @RickCogley mentioned, you will need to take a look at the JavaScript that is editing the Table of Contents output.