1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-10 00:12:09 +00:00

Remove extra canonical URL from post lists

I used Scratch to sort of pass variables to a partial, like a global
variable. Ugly but that's the price we pay for Hugo's concurrency and
caching.
This commit is contained in:
Rohan Kumar 2022-10-19 14:30:41 -07:00
parent e1213ddda6
commit 170165d845
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
3 changed files with 4 additions and 3 deletions

View file

@ -23,7 +23,8 @@
{{ .Title }}
</a>
</h2>
{{- partial "post-meta.html" .}}
{{- .Scratch.Set "noCanonical" true -}}
{{- partial "post-meta.html" . }}
{{- if eq .Section "notes" }}
<div class="e-content entry-content" itemprop="articleBody">
{{- if .Params.replyURI -}}

View file

@ -9,7 +9,7 @@
{{- $logURL = $logURL | strings.ReplaceRE `\.md` `.gmi` -}}
{{- end -}}
<p>
{{- $action }} <time{{ if not (.Params.evergreen) }} itemprop="dateCreated datePublished" class="dt-published published"{{ end }} datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time> by {{ partial "indieweb-author.html" -}} on his <a rel="canonical" itemprop="url" class="u-url url" href="{{ .Site.Params.CanonicalBaseURL }}{{ $canonicalRelPermalink }}">Website</a>{{- with .OutputFormats.Get "gemtext" -}}{{- printf " " -}}and <a rel="syndication" class="u-syndication" href="{{replace .Permalink "/gemini" "" 1 | safeURL}}">Gemini capsule</a>{{- end -}}.
{{- $action }} <time{{ if not (.Params.evergreen) }} itemprop="dateCreated datePublished" class="dt-published published"{{ end }} datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time> by {{ partial "indieweb-author.html" -}}{{ if not (.Scratch.Get "noCanonical") }} on his <a rel="canonical" itemprop="url" class="u-url url" href="{{ .Site.Params.CanonicalBaseURL }}{{ $canonicalRelPermalink }}">Website</a>{{- with .OutputFormats.Get "gemtext" -}}{{- printf " " -}}and <a rel="syndication" class="u-syndication" href="{{replace .Permalink "/gemini" "" 1 | safeURL}}">Gemini capsule</a>{{ end }}{{- end -}}.
{{- if gt (sub .Lastmod.Unix .Date.Unix) 900 -}}
<br />
Last updated <time itemprop="dateModified" class="dt-updated updated" datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Lastmod.Format "2006-01-02" }}</time>. <a href="{{ $logURL }}">Changelog</a>.

View file

@ -24,4 +24,4 @@
<a itemprop="url" href="https://seirdy.one/" rel="author me home cc:attributionURL" class="u-url u-uid url" property="cc:attributionName">
{{ partial "indieweb-icon.html" -}} <span itemprop="name" class="p-name fn n">
<span itemprop="givenName" class="p-given-name given-name">Rohan</span>&#160;<span itemprop="familyName" class="p-family-name family-name">Kumar</span></span></a>
</span>
</span>{{- /* no line break */ -}}