diff --git a/layouts/404.html b/layouts/404.html index d54c7c403b..7215db2a5c 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -24,7 +24,7 @@ {{- partial "custom-header.html" . }} - +
diff --git a/layouts/_default/index.json b/layouts/_default/index.json index c7fe1ca95f..b1a57ba196 100644 --- a/layouts/_default/index.json +++ b/layouts/_default/index.json @@ -2,7 +2,7 @@ {{- $pages := slice }} {{- range .Site.Pages }} {{- if and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSearchHiddenPages true) ) }} -{{- $pages = $pages | append (dict "uri" .RelPermalink "title" .Title "tags" .Params.tags "description" .Description "content" (.Plain | htmlUnescape)) }} +{{- $pages = $pages | append (dict "uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .)) "title" .Title "tags" .Params.tags "description" .Description "content" (.Plain | htmlUnescape)) }} {{- end }} {{- end }} {{- $pages | jsonify (dict "indent" " ") }} diff --git a/layouts/_default/index.search.js b/layouts/_default/index.search.js index 8d7cd72e78..e4703b33d3 100644 --- a/layouts/_default/index.search.js +++ b/layouts/_default/index.search.js @@ -2,7 +2,7 @@ {{- $pages := slice }} {{- range .Site.Pages }} {{- if and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSearchHiddenPages true) ) }} -{{- $pages = $pages | append (dict "uri" .RelPermalink "title" .Title "tags" .Params.tags "description" .Description "content" (.Plain | htmlUnescape)) }} +{{- $pages = $pages | append (dict "uri" (partial "relLangPrettyUglyURL.hugo" (dict "to" .)) "title" .Title "tags" .Params.tags "description" .Description "content" (.Plain | htmlUnescape)) }} {{- end }} {{- end -}} var relearn_search_index = {{ $pages | jsonify (dict "indent" " ") }} diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 68d2bf44a3..259bc304cd 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -14,7 +14,7 @@ {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} - {{ .Permalink }} + {{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }} Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} Hugo -- gohugo.io{{ with .Site.LanguageCode }} {{.}}{{end}}{{ with .Site.Author.email }} @@ -23,19 +23,19 @@ {{.}}{{end}}{{ if not .Date.IsZero }} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} {{- with .OutputFormats.Get "RSS" -}} - {{ printf "" .Permalink .MediaType | safeHTML }} + {{ printf "" ( partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true)) .MediaType | safeHTML }} {{- end -}} {{- range $pages }} {{- $relearnIsHiddenFrom := index ($page.Scratch.Get "relearnIsHiddenFrom") .RelPermalink }} {{- if and .Permalink .Title (or (not $relearnIsHiddenFrom) (ne .Site.Params.disableSeoHiddenPages true) ) }} {{ .Title }} - {{ .Permalink }} + {{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} {{- with .Site.Author.email }} {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}} {{- end }} - {{ .Permalink }} + {{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }} {{ .Summary | html }} {{- end }} diff --git a/layouts/_default/sitemap.xml b/layouts/_default/sitemap.xml index c73e794f9f..baa5200570 100644 --- a/layouts/_default/sitemap.xml +++ b/layouts/_default/sitemap.xml @@ -4,19 +4,19 @@ {{- range .Data.Pages }} {{- if and .Title (or (ne (.Scratch.Get "relearnIsHiddenStem") true) (ne .Site.Params.disableSeoHiddenPages true) ) }} - {{ .Permalink }}{{ if not .Lastmod.IsZero }} + {{ partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true) }}{{ if not .Lastmod.IsZero }} {{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}{{ end }}{{ with .Sitemap.ChangeFreq }} {{ . }}{{ end }}{{ if ge .Sitemap.Priority 0.0 }} {{ .Sitemap.Priority }}{{ end }}{{ if .IsTranslated }}{{ range .Translations }} {{ end }} {{ end }} {{- end -}} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index c0b31c9ec0..bdee1bd317 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -16,7 +16,7 @@ {{- else }} {{- range .AlternativeOutputFormats }} {{- if eq .Rel "canonical" }} - {{ (printf $link .Permalink .Rel .MediaType.Type ($title | htmlEscape)) | safeHTML }} + {{ (printf $link (partial "relLangPrettyUglyURL.hugo" (dict "to" . "abs" true)) .Rel .MediaType.Type ($title | htmlEscape)) | safeHTML }} {{- else if and (ne .Name "JSON") (ne .Name "SEARCH") }} {{ (printf $link (partial "relLangPrettyUglyURL.hugo" (dict "to" .)) .Rel .MediaType.Type ($title | htmlEscape)) | safeHTML }} {{- end }} @@ -34,7 +34,7 @@ {{- partialCached "stylesheet.html" (dict "page" . "outputFormat" $outputFormat) $outputFormat }} {{- partial "custom-header.html" . }} - +
diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index 69fca56271..d94eae54c1 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -154,7 +154,7 @@ {{- $currentAlwaysopen := .Params.alwaysopen | default $alwaysopen }} {{- $pageHash := md5 .Page }} {{- $isOpen := or $currentAlwaysopen $isSelf $isAncestor }} -
  • {{ if .Site.Params.collapsibleMenu }}{{ end }} +
  • {{ if .Site.Params.collapsibleMenu }}{{ end }} {{- partial "menu-pre.html" . }}{{ or .Params.menuTitle .LinkTitle .Title }}{{ partial "menu-post.html" . }} {{- if $showvisitedlinks }}{{ end }}
      {{- $defaultAlwaysopen := .Site.Params.alwaysopen | default true }} @@ -168,7 +168,7 @@ {{- end }} {{- end }}
  • {{- else }} -
  • +
  • {{- partial "menu-pre.html" . }}{{ or .Params.menuTitle .LinkTitle .Title }}{{ partial "menu-post.html" . }} {{- if $showvisitedlinks }}{{ end }}
  • {{- end }} diff --git a/layouts/partials/nested-content.hugo b/layouts/partials/nested-content.hugo index 824e52386b..f4fd5c7b03 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 "/" $page.RelPermalink }} +{{- $link_prefix := strings.TrimRight "/" (partial "relLangPrettyUglyURL.hugo" (dict "to" $page)) }} {{- $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 diff --git a/layouts/partials/relLangPrettyUglyURL.hugo b/layouts/partials/relLangPrettyUglyURL.hugo index 37edd55cfb..cd5a8cb0cf 100644 --- a/layouts/partials/relLangPrettyUglyURL.hugo +++ b/layouts/partials/relLangPrettyUglyURL.hugo @@ -1,5 +1,9 @@ {{- $to := .to }} +{{- $abs := .abs }} {{- $link := $to.RelPermalink }} +{{- if $abs }} + {{- $link = $to.Permalink }} +{{- end }} {{- if and (ne .Site.Params.disableExplicitIndexURLs true) (eq (substr $link -1) "/") }} {{- $link = printf "%sindex.html" $link }} {{- end }}