mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-12-18 03:43:31 +00:00
12 lines
No EOL
800 B
HTML
12 lines
No EOL
800 B
HTML
{{- $page := .page }}
|
|
{{- $content := .content }}
|
|
{{- $r_url := $page.RelPermalink }}
|
|
{{- with $page.OutputFormats.Get (partial "output-format.html" $page) }}
|
|
{{- $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)) }} |