From 812ba366b4335d3fb8a09eb484b0f873d5dbb32c Mon Sep 17 00:00:00 2001 From: David Karlsson <35727626+dvdksn@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:06:53 +0200 Subject: [PATCH] hugo: fix link generation For some inexplicable reason, the link render hook was failing, probably caused by cases where goldmark was called recursively by shortcodes. This change changas the render hook to use the global `pages` pointer instead of the .Pages pointer of the render hook context. Seems to work. Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com> --- layouts/_default/_markup/render-link.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html index e228664356..ff7c46c63f 100644 --- a/layouts/_default/_markup/render-link.html +++ b/layouts/_default/_markup/render-link.html @@ -13,7 +13,7 @@ {{- else if (strings.HasPrefix $url "/") -}} {{ if (strings.HasSuffix (urls.Parse $url).Path ".md") }} {{/* abs path to markdown file, use ref */}} - {{ $url = (ref .Page $url) }} + {{ $url = (ref page $url) }} {{ end }} {{ .Text | safeHTML }} {{- else -}} @@ -21,12 +21,12 @@ {{- if (strings.FindRE `([^_]|^)index.md` $url 1) -}} {{ .Text | safeHTML }} {{- else -}} {{/* relative link, use ref */}} - {{ .Text | safeHTML }} {{- end -}}