fix permalinks 21-12-11 19:17:01

This commit is contained in:
Illia Barkov 2021-12-11 19:17:01 +02:00
parent 63a83977ed
commit cfe011ddad
13 changed files with 28 additions and 20 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -24,7 +24,7 @@
<div class="archive-meta"> <div class="archive-meta">
{{- partial "post_meta.html" . -}} {{- partial "post_meta.html" . -}}
</div> </div>
<a class="entry-link" aria-label="post link to {{ .Title | plainify }}" href="{{ .Permalink }}"></a> <a class="entry-link" aria-label="post link to {{ .Title | plainify }}" href="{{ .RelPermalink }}"></a>
</div> </div>
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@ -46,7 +46,7 @@
<footer class="entry-footer"> <footer class="entry-footer">
{{- partial "post_meta.html" . -}} {{- partial "post_meta.html" . -}}
</footer> </footer>
<a class="entry-link" aria-label="post link to {{ .Title | plainify }}" href="{{ .Permalink }}"></a> <a class="entry-link" aria-label="post link to {{ .Title | plainify }}" href="{{ .RelPermalink }}"></a>
</article> </article>
{{- end }} {{- end }}

View File

@ -14,7 +14,7 @@
{{- i18n "translations" | default "Translations"}}: {{- i18n "translations" | default "Translations"}}:
{{- range .Translations }} {{- range .Translations }}
<li> <li>
<a href="{{ .Permalink }}"> <a href="{{ .RelPermalink }}">
{{- if (and $.Site.Params.displayFullLangName (.Language.LanguageName)) }} {{- if (and $.Site.Params.displayFullLangName (.Language.LanguageName)) }}
{{- .Language.LanguageName | emojify | humanize -}} {{- .Language.LanguageName | emojify | humanize -}}
{{- else }} {{- else }}

View File

@ -13,7 +13,7 @@
{{- $count := .Count }} {{- $count := .Count }}
{{- with $.Site.GetPage (printf "/%s/%s" $type $name) }} {{- with $.Site.GetPage (printf "/%s/%s" $type $name) }}
<li> <li>
<a href="{{ .Permalink }}">{{ .Name }} <sup><strong><sup>{{ $count }}</sup></strong></sup> </a> <a href="{{ .RelPermalink }}">{{ .Name }} <sup><strong><sup>{{ $count }}</sup></strong></sup> </a>
</li> </li>
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@ -13,10 +13,10 @@
{{- if (and (in $processableFormats $cover.MediaType.SubType) (ne .Site.Params.cover.responsiveImages false) (eq $prod true)) }} {{- if (and (in $processableFormats $cover.MediaType.SubType) (ne .Site.Params.cover.responsiveImages false) (eq $prod true)) }}
<img srcset="{{- range $size := $sizes -}} <img srcset="{{- range $size := $sizes -}}
{{- if (ge $cover.Width $size) -}} {{- if (ge $cover.Width $size) -}}
{{ printf "%s %s" (($cover.Resize (printf "%sx" $size)).Permalink) (printf "%sw ," $size) -}} {{ printf "%s %s" (($cover.Resize (printf "%sx" $size)).RelPermalink) (printf "%sw ," $size) -}}
{{ end }} {{ end }}
{{- end -}}{{$cover.Permalink }} {{printf "%dw" ($cover.Width)}}" {{- end -}}{{$cover.RelPermalink }} {{printf "%dw" ($cover.Width)}}"
sizes="(min-width: 768px) 720px, 100vw" src="{{ $cover.Permalink }}" alt="{{ $alt }}" /> sizes="(min-width: 768px) 720px, 100vw" src="{{ $cover.RelPermalink }}" alt="{{ $alt }}" />
{{- else }}{{/* Unprocessable image or responsive images disabled */}} {{- else }}{{/* Unprocessable image or responsive images disabled */}}
<img src="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" alt="{{ $alt }}"> <img src="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" alt="{{ $alt }}">
{{- end }} {{- end }}

View File

@ -18,7 +18,7 @@
{{- partial "extend_footer.html" . -}} {{- partial "extend_footer.html" . -}}
{{ if in site.Params.mainSections .Type }} {{ if in site.Params.mainSections .Type }}
{{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify | fingerprint }} {{- $highlight := slice (resources.Get "js/highlight.min.js") | resources.Concat "assets/js/highlight.js" | minify | fingerprint }}
<script defer src="{{ $highlight.Permalink }}" integrity="{{ $highlight.Data.Integrity }}" <script defer src="{{ $highlight.RelPermalink }}" integrity="{{ $highlight.Data.Integrity }}"
onload="hljs.initHighlightingOnLoad();"></script> onload="hljs.initHighlightingOnLoad();"></script>
{{- end }} {{- end }}
<script> <script>

View File

@ -16,13 +16,13 @@
{{- .Summary | default (printf "%s - %s" .Title .Site.Title) }}{{- else }} {{- .Summary | default (printf "%s - %s" .Title .Site.Title) }}{{- else }}
{{- with .Site.Params.description }}{{ . }}{{- end }}{{- end }}{{- end -}}"> {{- with .Site.Params.description }}{{ . }}{{- end }}{{- end }}{{- end -}}">
<meta name="author" content="{{ (partial "author.html" . ) }}"> <meta name="author" content="{{ (partial "author.html" . ) }}">
<link rel="canonical" href="{{ .Permalink }}" /> <link rel="canonical" href="{{ .RelPermalink }}" />
{{- if .Site.Params.analytics.google.SiteVerificationTag }} {{- if .Site.Params.analytics.google.SiteVerificationTag }}
<meta name="google-site-verification" content="{{ .Site.Params.analytics.google.SiteVerificationTag }}" /> <meta name="google-site-verification" content="{{ .Site.Params.analytics.google.SiteVerificationTag }}" />
{{- end}} {{- end}}
<!-- Styles --> <!-- Styles -->
{{- $stylesheet := (resources.Match "css/*.css") | resources.Concat "assets/css/stylesheet.css" | minify | fingerprint -}} {{- $stylesheet := (resources.Match "css/*.css") | resources.Concat "assets/css/stylesheet.css" | minify | fingerprint -}}
<link href="{{ $stylesheet.Permalink }}" integrity="{{ $stylesheet.Data.Integrity }}" rel="preload stylesheet" <link href="{{ $stylesheet.RelPermalink }}" integrity="{{ $stylesheet.Data.Integrity }}" rel="preload stylesheet"
as="style"> as="style">
<!-- Favicons --> <!-- Favicons -->
<link rel="icon" href="{{- .Site.Params.assets.favicon | default "favicon.ico" | absURL -}}"> <link rel="icon" href="{{- .Site.Params.assets.favicon | default "favicon.ico" | absURL -}}">
@ -39,10 +39,10 @@
{{- hugo.Generator }} {{- hugo.Generator }}
<!-- RSS --> <!-- RSS -->
{{- range .AlternativeOutputFormats -}} {{- range .AlternativeOutputFormats -}}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}"> <link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .RelPermalink | safeURL }}">
{{ end -}} {{ end -}}
{{- range .Translations -}} {{- range .Translations -}}
<link rel="alternate" hreflang="{{- .Lang -}}" href="{{- .Permalink -}}" /> <link rel="alternate" hreflang="{{- .Lang -}}" href="{{- .RelPermalink -}}" />
{{ end }} {{ end }}
{{- partial "extend_head.html" . -}} {{- partial "extend_head.html" . -}}
<!-- Misc --> <!-- Misc -->

View File

@ -90,7 +90,7 @@
{{- range . -}} {{- range . -}}
{{- if ne $lang .Lang }} {{- if ne $lang .Lang }}
<li> <li>
<a href="{{- .Permalink -}}" title="{{ .Language.LanguageName | default .Lang | humanize }}" <a href="{{- .RelPermalink -}}" title="{{ .Language.LanguageName | default .Lang | humanize }}"
aria-label="{{ .Language.LanguageName | default .Lang | humanize }}"> aria-label="{{ .Language.LanguageName | default .Lang | humanize }}">
{{- if (and $.Site.Params.displayFullLangName (.Language.LanguageName)) }} {{- if (and $.Site.Params.displayFullLangName (.Language.LanguageName)) }}
{{- .Language.LanguageName | emojify -}} {{- .Language.LanguageName | emojify -}}

View File

@ -1,4 +1,4 @@
{{- $pageurl := .Permalink }} {{- $pageurl := .RelPermalink }}
{{- $title := .Title }} {{- $title := .Title }}
{{ $.Scratch.Set "tags" ""}} {{ $.Scratch.Set "tags" ""}}

View File

@ -1,7 +1,7 @@
<meta property="og:title" content="{{ .Title }}" /> <meta property="og:title" content="{{ .Title }}" />
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" /> <meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" /> <meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" /> <meta property="og:url" content="{{ .RelPermalink }}" />
{{- if .Params.cover.image -}} {{- if .Params.cover.image -}}
{{- if (ne .Params.cover.relative true) }} {{- if (ne .Params.cover.relative true) }}
<meta property="og:image" content="{{ .Params.cover.image | absURL }}" /> <meta property="og:image" content="{{ .Params.cover.image | absURL }}" />
@ -16,7 +16,7 @@
{{- $featured := $images.GetMatch "*feature*" -}} {{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}} {{- with $featured -}}
<meta property="og:image" content="{{ $featured.Permalink }}"/> <meta property="og:image" content="{{ $featured.RelPermalink }}"/>
{{ else -}} {{ else -}}
{{- with $.Site.Params.images -}} {{- with $.Site.Params.images -}}
<meta property="og:image" content="{{ index . 0 | absURL }}"/> <meta property="og:image" content="{{ index . 0 | absURL }}"/>
@ -43,12 +43,12 @@
{{ end }}{{ end }} {{ end }}{{ end }}
{{- /* If it is part of a series, link to related articles */}} {{- /* If it is part of a series, link to related articles */}}
{{- $permalink := .Permalink }} {{- $permalink := .RelPermalink }}
{{- $siteSeries := .Site.Taxonomies.series }}{{ with .Params.series }} {{- $siteSeries := .Site.Taxonomies.series }}{{ with .Params.series }}
{{- range $name := . }} {{- range $name := . }}
{{- $series := index $siteSeries $name }} {{- $series := index $siteSeries $name }}
{{- range $page := first 6 $series.Pages }} {{- range $page := first 6 $series.Pages }}
{{- if ne $page.Permalink $permalink }}<meta property="og:see_also" content="{{ $page.Permalink }}" />{{ end }} {{- if ne $page.RelPermalink $permalink }}<meta property="og:see_also" content="{{ $page.RelPermalink }}" />{{ end }}
{{- end }} {{- end }}
{{ end }}{{ end }} {{ end }}{{ end }}

View File

@ -63,7 +63,7 @@
{{- end }} {{- end }}
"mainEntityOfPage": { "mainEntityOfPage": {
"@type": "WebPage", "@type": "WebPage",
"@id": {{ .Permalink | safeHTML }} "@id": {{ .RelPermalink | safeHTML }}
}, },
"publisher": { "publisher": {
"@type": "{{- ( .Site.Params.schema.publisherType | default "Organization") | humanize -}}", "@type": "{{- ( .Site.Params.schema.publisherType | default "Organization") | humanize -}}",

View File

@ -15,7 +15,7 @@
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}} {{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}} {{- with $featured -}}
<meta name="twitter:card" content="summary_large_image"/> <meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="{{ $featured.Permalink }}"/> <meta name="twitter:image" content="{{ $featured.RelPermalink }}"/>
{{- else -}} {{- else -}}
{{- with $.Site.Params.images -}} {{- with $.Site.Params.images -}}
<meta name="twitter:card" content="summary_large_image"/> <meta name="twitter:card" content="summary_large_image"/>