Table of Contents, + header anchor links

This post is imported from community.blogs.hyvor.com.

Original Author: amytg
Date of publishing: 12 months ago
URL to original post: Click here

This may be a theme-by-theme feature, but a table of contents is sometimes handy for users wanting to get an overview of longer posts or pages.

It could automatically capture headings → turn them into anchor links which are subsequently inside a sticky list on the right or left or top of the page. On mobile, sometimes this is added to a small, collapsed menu.

A separate, but related feature is to make headings clickable anchor links so that users who want to share the URL to a specific heading can just click the heading + copy the URL (or right-click a heading and copy that URL).

An example of both features:

If you click any of the H2 headings, such as Reference, they’ll change the site URL to that (e.g,. an ID is set and the text is a link to its own ID). Also, on the right side, we have a sticky table of contents with large clickable headings + highlighting when in view.

This comment is imported from community.blogs.hyvor.com.

Original Author: supun
Date of publishing: 12 months ago
URL to original post: Click here

These need to be implemented at the theme level. However, I think both these features are very much required for almost all themes. So, we’ll add both of these to our publishing guidelines. (Publishing - Hyvor Blogs Docs)

Just letting you know, you can also send a PR to our themes: GitHub - hyvor/hyvor-blogs-themes: Hyvor Blogs Themes

This comment is imported from community.blogs.hyvor.com.

Original Author: amytg
Date of publishing: 11 months ago
URL to original post: Click here

Ah, that’s fantastic. Thank you so much. This would be an excellent feature. Unfortunately, I don’t have a PR to contribute :sob: But, I can create an issue there if that’s easier to track?

This comment is imported from community.blogs.hyvor.com.

Original Author: supun
Date of publishing: 8 months ago
URL to original post: Click here

Heading anchors are now available: https://community.blogs.hyvor.com/changelog/64a557a4ca108a14db4fe432

ToC coming soon :slight_smile: