backdrop-contrib / tocbot

Builds a table of contents (TOC) from content headings.
GNU General Public License v2.0
2 stars 2 forks source link

Optional "Back to top" link beside headings #40

Closed herbdool closed 3 years ago

herbdool commented 3 years ago

I'm trying this module out with a client. The design doesn't have a sidebar so the tocbot block is at the top of the content. Once someone clicks a link in the table of contents and goes to the relevant heading, there's no easy way to go back to the TOC. Perhaps if there was a Back to top link after each heading as an option, this would help.

olafgrabienski commented 3 years ago

Thanks for trying Tocbot! A "Back to top" link sounds like a useful option, I'm however not sure how to realize it. Thoughts:

One solution could be to get the option in the Tocbot library. Looking at https://github.com/tscanlin/tocbot, I didn't find this feature. I've also scanned the issue queue but not thoroughly. Not sure if it's realistic to get the feature added in the library.

Or are you maybe up to provide a library independent solution for the Tocbot module?

As a third approach, maybe build a small module which just provides the Back to top links.

Variation of 3: extend https://github.com/backdrop-contrib/permalink_filter or https://github.com/backdrop-contrib/back_to_top to provide the option. (Using the Back to Top module could also be a workaround.)

herbdool commented 3 years ago

Thanks for looking at this @olafgrabienski. Probably back_to_top module is the best option here. The tocbot library seems pretty focused so that makes sense.