fix: PermaLink to RelPermalink

This commit is contained in:
Junyi Hou 2024-04-09 19:33:28 +08:00
parent f774d2689d
commit 9f33764cff
7 changed files with 18 additions and 20 deletions

View file

@ -16,7 +16,7 @@
{{ end }}
{{ with .OutputFormats.Get "rss" -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .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 }}
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">

View file

@ -9,7 +9,7 @@
{{ if eq .Lang $pageLang }}
<li>{{ .Language.LanguageName }}</li>
{{ else }}
<li><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
<li><a href="{{ .RelPermalink }}">{{ .Language.LanguageName }}</a></li>
{{ end }}
{{ end }}
</ul>

View file

@ -18,7 +18,7 @@
</div>
{{ end }}
<a class="post-hidden-url u-url" href="{{ .Permalink }}">{{ .Permalink }}</a>
<a class="post-hidden-url u-url" href="{{ .RelPermalink }}">{{ .RelPermalink }}</a>
<a href="{{ .Site.BaseURL }}" class="p-name p-author post-hidden-author h-card" rel="me">{{ .Params.author | default .Site.Params.author }}</a>
@ -27,7 +27,7 @@
<ul class="post-categories">
{{ range $cat_name := .Params.categories }}
{{ $cat := ($.Site.GetPage (printf "/categories/%s" $cat_name | urlize )) }}
<li><a href="{{ $cat.Permalink }}">{{ $cat.Title | default $cat_name }}</a></li>
<li><a href="{{ $cat.RelPermalink }}">{{ $cat.Title | default $cat_name }}</a></li>
{{ end }}
</ul>
{{ end }}
@ -35,7 +35,7 @@
<ul class="post-tags">
{{ range $tag_name := .Params.tags }}
{{ $tag := ($.Site.GetPage (printf "/tags/%s" $tag_name | urlize )) }}
<li><a href="{{ $tag.Permalink }}">#{{ $tag.Title | default $tag_name }}</a></li>
<li><a href="{{ $tag.RelPermalink }}">#{{ $tag.Title | default $tag_name }}</a></li>
{{ end }}
</ul>
{{ end }}
@ -43,7 +43,7 @@
<ul class="post-authors">
{{ range $author_name := .Params.authors }}
{{ $author := ($.Site.GetPage (printf "/authors/%s" $author_name | urlize )) }}
<li><a href="{{ $author.Permalink }}">@{{ $author_name }}</a></li>
<li><a href="{{ $author.RelPermalink }}">@{{ $author_name }}</a></li>
{{ end }}
</ul>
{{ end }}

View file

@ -15,9 +15,9 @@
{{ $resource = $resource | resources.Fingerprint "sha256" }}
{{ if eq .type "css" }}
<link rel="stylesheet" href="{{ $resource.Permalink }}" integrity="{{ $resource.Data.Integrity }}">
<link rel="stylesheet" href="{{ $resource.RelPermalink }}" integrity="{{ $resource.Data.Integrity }}">
{{ else if eq .type "js" }}
<script src="{{ $resource.Permalink }}" type="text/javascript" charset="utf-8" integrity="{{ $resource.Data.Integrity }}"></script>
<script src="{{ $resource.RelPermalink }}" type="text/javascript" charset="utf-8" integrity="{{ $resource.Data.Integrity }}"></script>
{{ end }}
<!-- For backward compatibility -->
{{ else }}

View file

@ -27,11 +27,11 @@
{{ if .Site.Params.rssAsSocialIcon }}
{{ with .Site.Home.OutputFormats.Get "rss" -}}
<li>
<a {{ printf "href=%q" .Permalink | safeHTMLAttr }} title="RSS" rel="me">
<a {{ printf "href=%q" .RelPermalink | safeHTMLAttr }} title="RSS" rel="me">
{{ partial "font-awesome.html" (dict "iconName" "rss" "custom" false) }}
</a>
</li>
{{ end -}}
{{ end }}
</ul>
</ul>