Check this shortcode if you need a more foolproof and feature-rich way of linking. It is especially useful for documentation sites where multiple people write, edit, and move pages.
It will:
- Keep the link working if someone moves the target page.
- Automatically use the page title as the link text if the target is a page.
- Automatically use the heading text as the link text if the target is a heading (on the same or another page).
Code is here: hugo/layouts/shortcodes/elink.html at main · boevski/hugo · GitHub
Usage instructions are here: hugo/README.md at main · boevski/hugo · GitHub
I’d love so see a similar mechanisms implemented out of the box! This is a must-have for documentation sites IMHO. I see other people have been asking for it here and here.