From 8212caf654d8c075072edbbd3a2508cf99436d6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Wed, 25 Jan 2023 21:19:49 +0100 Subject: [PATCH] print: fix image links with relative path #444 revert changes of #385 --- layouts/partials/nested-content.hugo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/partials/nested-content.hugo b/layouts/partials/nested-content.hugo index f4fd5c7b03..824e52386b 100644 --- a/layouts/partials/nested-content.hugo +++ b/layouts/partials/nested-content.hugo @@ -1,7 +1,7 @@ {{- $page := .page }} {{- $outputFormat := .outputFormat }} {{- $c:=""}}{{/* if we have a relative link in a print page, our print URL is one level to deep; so we are making it absolute to our page by prepending the page's permalink */}} -{{- $link_prefix := strings.TrimRight "/" (partial "relLangPrettyUglyURL.hugo" (dict "to" $page)) }} +{{- $link_prefix := strings.TrimRight "/" $page.RelPermalink }} {{- $content := partial "output-partial.hugo" (dict "base" "content" "page" $page "parameter" $page "outputFormat" $outputFormat) }} {{- $content = replaceRE "((?:src|href)\\s*=(?:\\s*[\"']\\s*)?)(\\.[^\"'\\s>]*|[\\w]+[^\"'\\s>:]*)([\"'\\s>])" (printf "${1}%s/${2}${3}" $link_prefix) $content }} {{- partial "output-partial.hugo" (dict "base" "article" "page" $page "parameter" (dict "page" $page "content" $content "outputFormat" $outputFormat) "outputFormat" $outputFormat) }} \ No newline at end of file