Table of Content won't jump to the section

I generated a table of content, using {{ .Page.TableOfContents }},

It generates table of content. However, when I click the link in the toc, it won’t move to that head section.

I realize with a slash the table of content won’t work, for example the link of the 2nd section of a post is https://example.com/post/post1/#2ndsection
while clicking it will not go to that section. However without backslash https://example.com/post/post1#2ndsection, the browser will move to 2nd section.

Anyone have the same problem like what I have?

Please help me to solve this problem.

Thanks.

Please let us see either the repo or a live website with this phenomenon. From the description, both links should work identically. But what could be is, that you have a JS library in use that is having difficulties to discern between its own links and the hashtags in the URL. Some libraries use the hash for navigation purposes (dynamic loading of content) and will disable the action of the browser.

Thank you for your reply,

I figured out it is the turbolinks.js that cause the problem. However, the theme need turbolinks, any suggestion?

actually “turbolinks” is a trigger word :wink: I know some themes that depend on that plugin and they won’t work either… The thing is that the plugin is no longer developed, so… yeah… deprecation…

On the other side, as far as I understand the plugin you can safely remove it and things keep working. They won’t just stay as “fast” as turbolinks was doing the site before.

Thank you David for helping me out!

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