Merge pull request #2 from restot/permalink_fix

fix permalinks  21-12-11 19:17:01
This commit is contained in:
restot 2021-12-11 12:21:28 -05:00 committed by GitHub
commit 4b97ed6945
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 24 additions and 14 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

@ -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

@ -90,7 +90,9 @@
{{- range . -}} {{- range . -}}
{{- if ne $lang .Lang }} {{- if ne $lang .Lang }}
<li> <li>
<a href="{{- .RelPermalik -}}" title="{{ .Language.LanguageName | default .Lang | humanize }}" <a href="{{- .RelPermalik -}}" 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"/>