Thanks for taking your time on making the example!
Just in case someone else is trying out this example - it doesn’t work on hugo 0.141.0. I had to update to the latest version (0.148.2 at the moment).
Also I’m using hugo-book theme and I had to update _default/_markup/render-heading.html with the latest hugo-book version to make the css style forwardable (related diff Introduce landing page and card shortcode · alex-shpak/hugo-book@4722375 · GitHub ).
The only thing left is to make the details open when user follows the anchor. Browsers seem to support automatically opening the details if the anchor is in the details content. But with our current approach the anchor becomes part of the summary, so it doesn’t work. Hypothetical solution is to make an empty heading element with the anchor generated from the title/summary and put it inside the details contents, but I don’t know if it’s possible.
I found the similar topic but it seems to be unresolved Automatic anchor links for paragraphs?