A Hugo module providing render hooks for links and images.
Centrally manage frequently used URLs in a single data file (data/link-hub.yaml). In Markdown, reference a link by its ID instead of its URL — if the URL changes, you only update it in one place.
Links support URL parameters: define a URL template with {1}, {2}, … placeholders and pass values directly in the Markdown.
Invalid link IDs are rendered as a visible error in the page and logged as a warning during the Hugo build.
Extends Hugo's default image render hook to correctly resolve images referenced with absolute paths (e.g. /media/image.jpg) as Hugo resources, and falls back to a baseURL-relative URL for static files from domain-based hosting setups.
Add the module to your hugo.yaml:
module:
imports:
- path: "gitlab.com/renzok/hugo-mod-link-hub"Create data/link-hub.yaml in your project:
links:
- id: "docs"
url: "/docs"
- id: "adr"
url: "/decision-records/{1}"[Getting Started](<$docs>)[ADR with param](<$adr make-use-of-adr>)The {1} placeholder in the URL is replaced with make-use-of-adr.
The link destination must be wrapped in angle brackets (<…>) because the $ prefix and any parameters contain characters that CommonMark does not allow in bare link destinations.
Following https://gohugo.io/functions/urls/absurl/ or https://gohugo.io/functions/urls/abslangurl/
you should always provide the link relative to baseURL WITHOUT a leading slash /.
To preview the module in isolation, create a hugo.local.yaml (git-ignored) that adds a theme:
baseURL: 'http://localhost:1313/'
title: "link-hub-test"
module:
imports:
- path: "github.com/yihui/hugo-xmin"Also create a content file using named links (e.g. content/test.md):
---
title: "Test"
date: 2026-01-01
---
[Named link](<$your-link-id>)And then
hugo server --config hugo.local.yaml --port 1414