Is there some magical way in Hugo to iterate through (or even simply list) all the links in a rendered page? Haven’t dug into this deep, so if anyone knows off-hand please point me in the right direction. Thanks!
With Hugo no way (yet). Would be nice to have a page attribute list of this like .LinkList
Check GitHub for this issue and 1++ it!
added #6514
There is plans to add a data structure on page, e.g.
Page.ContentMap
=> Headers
=> TableOfContents
=> Images
=> Links
=> whatever
I would also love if at least some of these had pointers into the rendered content, so I could walk the content tree in my template and do stuff ala:
- Insert adds after every third headline
- Add byline after the first paragraph
- …
4 Likes
Nice, thanks.
For now, I guess I can post-process outside of Hugo after pages have been rendered.
Exposing Goldmark’s AST in Hugo to access and manipulate things would be awesome, but could be difficult to design in a usable way.