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

More caching of partials (+ fix a typo)

This commit is contained in:
Rohan Kumar 2023-11-29 06:45:53 -08:00
parent fb33951b8f
commit 2796526310
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
6 changed files with 9 additions and 13 deletions

View file

@ -2,7 +2,7 @@
<footer>
{{ partial "breadcrumblist.html" . }}
<p>
Copyright <time itemprop="copyrightYear" datetime="{{now.Year}}">{{now.Year}}</time> {{ partial "indieweb-author.html" -}}
Copyright <time itemprop="copyrightYear" datetime="{{now.Year}}">{{now.Year}}</time> {{ partialCached "indieweb-author.html" . -}}
</p>
<nav aria-label="site info">
<ul>

View file

@ -2,6 +2,8 @@
<footer>
<h2 id="interact" tabindex="-1">Interact</h2>
<p>You can interact by <a href="#webmentions">sending webmentions</a> or by visiting a syndicated copy of this post.</p>
{{ with .Params.syndicatedCopies }}
{{- partial "syndication.html" . -}}
{{- end -}}
{{- partial "webmentions/webmentions.html" . -}}
</footer>

View file

@ -25,7 +25,7 @@
<p>
{{- end }}
{{ if $needsList }}<li>{{ end }}
{{- $action }} <time{{ if not (.Params.evergreen) }} itemprop="dateCreated datePublished" class="dt-published published"{{ end }} datetime="{{ .Date.UTC.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.UTC.Format "2006-01-02" }}</time> by {{ partial "indieweb-author.html" -}}{{ if not $shortMeta }} 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="{{ $gemini }}">Gemini capsule</a>{{ end }}{{- end -}}.
{{- $action }} <time{{ if not (.Params.evergreen) }} itemprop="dateCreated datePublished" class="dt-published published"{{ end }} datetime="{{ .Date.UTC.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.UTC.Format "2006-01-02" }}</time> by {{ partialCached "indieweb-author.html" . -}}{{ if not $shortMeta }} 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="{{ $gemini }}">Gemini capsule</a>{{ end }}{{- end -}}.
{{ if $needsList }}</li>{{ end }}
{{- if gt (sub .Lastmod.Unix .Date.Unix) 900 -}}
{{ if $needsList }}<li>{{ end }}

View file

@ -1,4 +1,3 @@
{{ with .Params.syndicatedCopies }}
<h3>Syndication</h3>
<p>This post has been syndicated to:</p>
<ul>
@ -12,4 +11,3 @@
</li>
{{- end -}}
</ul>
{{- end -}}

View file

@ -13,16 +13,12 @@
{{- /* We can't just use a simple "where" function because we need to ignore URL anchors/query-params when making a comparison: https://discourse.gohugo.io/t/add-like-comparison-operator-to-the-where-function/42013/4 */ -}}
{{- $webmentions := slice -}}
{{- range partialCached "webmentions/all-webmentions.html" . -}}
{{- if in $targets .target -}}
{{ $webmentions = $webmentions | append . }}
{{- else -}}
{{- $u := urls.Parse .target -}}
{{- $trimmedTarget := printf `https://%s%s` $u.Hostname $u.Path -}}
{{- if in $targets $trimmedTarget -}}
{{ $webmentions = $webmentions | append . }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- /* Render webmentions if they exist */ -}}
{{- $count := (len $webmentions) -}}
{{- .Page.Scratch.Set "webmentionCount" $count -}}<!--For use in atom feed-->
@ -40,7 +36,7 @@
{{- if findRE "@Seirdy" $webmention.title -}}
{{- $title = $title | replaceRE `^@Seirdy@pleroma.envs.net(\n| )?` "" -}}
{{- /* Mastodon webmentions may include the author in the title followed by a colon; this is redundant. */ -}}
{{- if and (isset $webmention "author_name") (findRE `@` $webmention.source) (not (findRE "^https://bridg.gy" $webmention.source)) -}}
{{- if and (isset $webmention "author_name") (findRE `@` $webmention.source) (not (findRE "^https://brid.gy" $webmention.source)) -}}
{{ $title = $title | replaceRE `^[^:]{0,20}: ?` "" | replaceRE `^"@Seirdy@pleroma.envs.net ?` `"` }}
{{- end -}}
{{- end -}}

View file

@ -22,6 +22,6 @@
(btw this is all made of <span> cuz it is supposed to be inline)
--><span itemprop="author copyrightHolder" itemscope="" itemtype="https://schema.org/Person" itemid="https://seirdy.one/#seirdy" class="h-card p-author author vcard">
<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">
{{ partialCached "indieweb-icon.html" . -}} <span itemprop="name" class="p-name fn n">
<span itemprop="givenName" class="p-given-name given-name">Rohan</span><span itemprop="additionalName" class="p-additional-name additional-name">Seirdy</span><span itemprop="familyName" class="p-family-name family-name">Kumar</span></span></a>
</span>{{- /* no line break */ -}}