From 9f33764cffa4038956c889b658a203939d2cd031 Mon Sep 17 00:00:00 2001 From: Junyi Hou Date: Tue, 9 Apr 2024 19:33:28 +0800 Subject: [PATCH] fix: PermaLink to RelPermalink --- layouts/_default/rss.xml | 8 ++++---- layouts/_default/sitemap.xml | 8 ++++---- layouts/partials/head.html | 4 +--- layouts/partials/language-switcher.html | 2 +- layouts/partials/post-info.html | 8 ++++---- layouts/partials/resource.html | 4 ++-- layouts/partials/social-icons.html | 4 ++-- 7 files changed, 18 insertions(+), 20 deletions(-) diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index cc620f4..15a4ed7 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -9,7 +9,7 @@ {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} - {{ .Permalink }} + {{ .RelPermalink }} {{ .Site.Title }}{{ if ne .Title .Site.Title }}{{ with .Title }} ({{.}}){{ end }}{{ end }} Hugo -- gohugo.io{{ with .Site.LanguageCode }} {{.}}{{end}}{{ with .Site.Author.email }} @@ -18,15 +18,15 @@ {{.}}{{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 "" .RelPermalink .MediaType | safeHTML }} {{ end }} {{ range $pages }} {{ .Title }} - {{ .Permalink }} + {{ .RelPermalink }} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} - {{ .Permalink }} + {{ .RelPermalink }} {{ .Content | html }} {{ end }} diff --git a/layouts/_default/sitemap.xml b/layouts/_default/sitemap.xml index eb83a60..7d4284f 100644 --- a/layouts/_default/sitemap.xml +++ b/layouts/_default/sitemap.xml @@ -2,21 +2,21 @@ {{ range where .Data.Pages "Params.hidden" "!=" true }} - {{- if .Permalink -}} + {{- if .RelPermalink -}} - {{ .Permalink }}{{ if not .Lastmod.IsZero }} + {{ .RelPermalink }}{{ 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/head.html b/layouts/partials/head.html index b5f4bf5..f3d038e 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -16,7 +16,7 @@ {{ end }} {{ with .OutputFormats.Get "rss" -}} - {{ printf `` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} + {{ printf `` .Rel .MediaType.Type .RelPermalink $.Site.Title | safeHTML }} {{ end -}} {{ partial "favicons.html" . }} @@ -56,8 +56,6 @@ {{ $opts := dict "transpiler" "libsass" "targetPath" "css/style.css" }} - - {{ range site.Params.customCSS }} {{ with resources.Get . | toCSS $opts | minify | fingerprint }} diff --git a/layouts/partials/language-switcher.html b/layouts/partials/language-switcher.html index df9c6ef..b4a9a96 100644 --- a/layouts/partials/language-switcher.html +++ b/layouts/partials/language-switcher.html @@ -9,7 +9,7 @@ {{ if eq .Lang $pageLang }}
  • {{ .Language.LanguageName }}
  • {{ else }} -
  • {{ .Language.LanguageName }}
  • +
  • {{ .Language.LanguageName }}
  • {{ end }} {{ end }} diff --git a/layouts/partials/post-info.html b/layouts/partials/post-info.html index 641b66a..ad40c71 100644 --- a/layouts/partials/post-info.html +++ b/layouts/partials/post-info.html @@ -18,7 +18,7 @@ {{ end }} - {{ .Permalink }} + {{ .RelPermalink }} {{ .Params.author | default .Site.Params.author }} @@ -27,7 +27,7 @@ {{ end }} @@ -35,7 +35,7 @@ {{ end }} @@ -43,7 +43,7 @@ {{ end }} diff --git a/layouts/partials/resource.html b/layouts/partials/resource.html index 1ecc5e5..34ae2da 100644 --- a/layouts/partials/resource.html +++ b/layouts/partials/resource.html @@ -15,9 +15,9 @@ {{ $resource = $resource | resources.Fingerprint "sha256" }} {{ if eq .type "css" }} - + {{ else if eq .type "js" }} - + {{ end }} {{ else }} diff --git a/layouts/partials/social-icons.html b/layouts/partials/social-icons.html index e358068..9f5ab93 100644 --- a/layouts/partials/social-icons.html +++ b/layouts/partials/social-icons.html @@ -27,11 +27,11 @@ {{ if .Site.Params.rssAsSocialIcon }} {{ with .Site.Home.OutputFormats.Get "rss" -}}
  • - + {{ partial "font-awesome.html" (dict "iconName" "rss" "custom" false) }}
  • {{ end -}} {{ end }} - \ No newline at end of file +