1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-10 00: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> <footer>
{{ partial "breadcrumblist.html" . }} {{ partial "breadcrumblist.html" . }}
<p> <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> </p>
<nav aria-label="site info"> <nav aria-label="site info">
<ul> <ul>

View file

@ -2,6 +2,8 @@
<footer> <footer>
<h2 id="interact" tabindex="-1">Interact</h2> <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> <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" . -}} {{- partial "syndication.html" . -}}
{{- end -}}
{{- partial "webmentions/webmentions.html" . -}} {{- partial "webmentions/webmentions.html" . -}}
</footer> </footer>

View file

@ -25,7 +25,7 @@
<p> <p>
{{- end }} {{- end }}
{{ if $needsList }}<li>{{ 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 $needsList }}</li>{{ end }}
{{- if gt (sub .Lastmod.Unix .Date.Unix) 900 -}} {{- if gt (sub .Lastmod.Unix .Date.Unix) 900 -}}
{{ if $needsList }}<li>{{ end }} {{ if $needsList }}<li>{{ end }}

View file

@ -1,4 +1,3 @@
{{ with .Params.syndicatedCopies }}
<h3>Syndication</h3> <h3>Syndication</h3>
<p>This post has been syndicated to:</p> <p>This post has been syndicated to:</p>
<ul> <ul>
@ -12,4 +11,3 @@
</li> </li>
{{- end -}} {{- end -}}
</ul> </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 */ -}} {{- /* 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 -}} {{- $webmentions := slice -}}
{{- range partialCached "webmentions/all-webmentions.html" . -}} {{- range partialCached "webmentions/all-webmentions.html" . -}}
{{- if in $targets .target -}}
{{ $webmentions = $webmentions | append . }}
{{- else -}}
{{- $u := urls.Parse .target -}} {{- $u := urls.Parse .target -}}
{{- $trimmedTarget := printf `https://%s%s` $u.Hostname $u.Path -}} {{- $trimmedTarget := printf `https://%s%s` $u.Hostname $u.Path -}}
{{- if in $targets $trimmedTarget -}} {{- if in $targets $trimmedTarget -}}
{{ $webmentions = $webmentions | append . }} {{ $webmentions = $webmentions | append . }}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- end -}}
{{- /* Render webmentions if they exist */ -}} {{- /* Render webmentions if they exist */ -}}
{{- $count := (len $webmentions) -}} {{- $count := (len $webmentions) -}}
{{- .Page.Scratch.Set "webmentionCount" $count -}}<!--For use in atom feed--> {{- .Page.Scratch.Set "webmentionCount" $count -}}<!--For use in atom feed-->
@ -40,7 +36,7 @@
{{- if findRE "@Seirdy" $webmention.title -}} {{- if findRE "@Seirdy" $webmention.title -}}
{{- $title = $title | replaceRE `^@Seirdy@pleroma.envs.net(\n| )?` "" -}} {{- $title = $title | replaceRE `^@Seirdy@pleroma.envs.net(\n| )?` "" -}}
{{- /* Mastodon webmentions may include the author in the title followed by a colon; this is redundant. */ -}} {{- /* 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 ?` `"` }} {{ $title = $title | replaceRE `^[^:]{0,20}: ?` "" | replaceRE `^"@Seirdy@pleroma.envs.net ?` `"` }}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}

View file

@ -22,6 +22,6 @@
(btw this is all made of <span> cuz it is supposed to be inline) (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"> --><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"> <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 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 */ -}} </span>{{- /* no line break */ -}}