# Linking by unique ID

**URL:** https://discourse.gohugo.io/t/linking-by-unique-id/53304
**Category:** tips & tricks
**Created:** [January 28, 2025, 2:17pm UTC](https://discourse.gohugo.io/t/linking-by-unique-id/53304 "2025-01-28T14:17:06Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![gvaley](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@gvaley](https://discourse.gohugo.io/u/gvaley)
#### Post date: [January 28, 2025, 2:17pm UTC](https://discourse.gohugo.io/t/linking-by-unique-id/53304/1 "2025-01-28T14:17:06Z")

</div>

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](https://github.com/boevski/hugo/blob/main/layouts/shortcodes/elink.html)  
Usage instructions are here: [hugo/README.md at main · boevski/hugo · GitHub](https://github.com/boevski/hugo/blob/main/README.md#elinkhtml)

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](https://discourse.gohugo.io/t/unique-id-and-managing-many-internal-links/32260) and [here](https://discourse.gohugo.io/t/persistent-link-or-id-for-a-page/18588).
