Skip to content

Prepare links for link validation#110

Open
thomasrebele wants to merge 1 commit into
apache:mainfrom
thomasrebele:tr/prepare-links
Open

Prepare links for link validation#110
thomasrebele wants to merge 1 commit into
apache:mainfrom
thomasrebele:tr/prepare-links

Conversation

@thomasrebele

@thomasrebele thomasrebele commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Use {{% ref "..." %}} instead of {{< ref "..." >}}, so that a future link validator will get the link before it is passed to Goldmark. The Goldmark renderer will replace the URL with a shortcode that cannot be validated anymore. (See https://discourse.gohugo.io/t/using-shortcode-inside-render-hook/42038/5).

The modifications have been done with the following command:

perl -pi -e 's/\{\{< ref "([^"]*)" >\}\}/{{% ref "\1" %}}/gm' **/*.md

Edit: I've removed the unnecessary arg 0; I've verified that the result stays the same.

Use {{% ref "..." %}} instead of {{< ref "..." >}}, so that a future
link validator will get the link before it is passed to Goldmark.
The Goldmark renderer will replace the URL with a shortcode that cannot
be validated anymore.

Source:
https://discourse.gohugo.io/t/using-shortcode-inside-render-hook/42038/5

The modifications have been done with the following command:

perl -0pi -e 's/\{\{< ref "([^"]*)" >\}\}/{{% ref "\1" %}}/gm' **/*.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant