mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-24 00:03:10 +00:00
12 lines
No EOL
810 B
HTML
12 lines
No EOL
810 B
HTML
{{- $page := .page }}
|
|
{{- $content := .content }}
|
|
{{- $r_url := .RelPermalink }}
|
|
{{- with $page.OutputFormats.Get (($page.Scratch.Get "relearnOutputFormat") | lower) }}
|
|
{{- $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)) }} |