2022-07-09 14:38:28 +00:00
{{- $page := .page }}
{{- $content := .content }}
2022-07-09 16:42:20 +00:00
{{- $r_url := $page.RelPermalink }}
2022-07-10 22:59:26 +00:00
{{- with $page.OutputFormats.Get (partial "output-format.html" $page) }}
2022-07-09 14:38:28 +00:00
{{- $s_url := .RelPermalink }}
{{- if not (eq $s_url $r_url) }}
{{/* if we have a relative link in output formats with a path setting, our URLs are one level to deep; so we are making them absolute to our page by prepending the page's permalink */}}
{{- $link_prefix := strings.TrimRight "/" $page.Page.RelPermalink }}
{{- $content = replaceRE "((?:src|href)\\s*=(?:\\s*[\"']\\s*)?)(\\.[^\"'\\s>]*|[\\w]+[^\"'\\s>:]*)([\"'\\s>])" (printf "${1}%s/${2}${3}" $link_prefix) $content }}
{{- end }}
{{- end }}
{{- partial "output-partial.html" (dict "base" "article" "page" $page "parameter" (dict "page" $page "content" $content)) }}