{{- $page := .page }} {{- $content := .content }} {{- $r_url := $page.RelPermalink }} {{- with $page.OutputFormats.Get ($page.Scratch.Get "relearnOutputFormat") }} {{- $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)) }}