mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-23 21:02:09 +00:00
Fix post-meta partial
Instead of scratch variables, pass an additional variable into the template context
This commit is contained in:
parent
83a081438b
commit
d3081ddc8a
3 changed files with 13 additions and 13 deletions
|
@ -24,7 +24,7 @@
|
||||||
</a>
|
</a>
|
||||||
</h2>
|
</h2>
|
||||||
{{- .Scratch.Set "shortMeta" true -}}
|
{{- .Scratch.Set "shortMeta" true -}}
|
||||||
{{- partial "post-meta/post-meta.html" . }}
|
{{- partial "post-meta/post-meta.html" (dict "context" . "isList" true) }}
|
||||||
{{- if eq .Section "notes" }}
|
{{- if eq .Section "notes" }}
|
||||||
<div class="e-content entry-content" itemprop="articleBody">
|
<div class="e-content entry-content" itemprop="articleBody">
|
||||||
{{- if .Params.replyURI -}}
|
{{- if .Params.replyURI -}}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<header>
|
<header>
|
||||||
<h1 itemprop="name headline" class="p-name entry-title" id="h1" tabindex="-1">{{ .Title }}</h1>
|
<h1 itemprop="name headline" class="p-name entry-title" id="h1" tabindex="-1">{{ .Title }}</h1>
|
||||||
{{- if not .Params.disableMeta -}}
|
{{- if not .Params.disableMeta -}}
|
||||||
{{- partial "post-meta/post-meta.html" . -}}
|
{{- partial "post-meta/post-meta.html" (dict "context" . "isList" false) -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
</header>
|
</header>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
{{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" -}}
|
{{- $canonicalRelPermalink := .context.RelPermalink | replaceRE "^/~seirdy/" "/" -}}
|
||||||
{{- $isNotes := false -}}
|
{{- $isNotes := false -}}
|
||||||
{{- $action := "Posted" -}}
|
{{- $action := "Posted" -}}
|
||||||
{{- $shortMeta := false -}}
|
{{- $shortMeta := false -}}
|
||||||
{{- $logURL := printf "%scontent/%s" .Site.Params.logUrlPrefix .File.Path -}}
|
{{- $logURL := printf "%scontent/%s" .context.Site.Params.logUrlPrefix .context.File.Path -}}
|
||||||
{{- if .Scratch.Get "shortMeta" -}}
|
{{- if .context.Scratch.Get "shortMeta" -}}
|
||||||
{{- $shortMeta = true -}}
|
{{- $shortMeta = true -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- if or (eq .Page.Section "notes") (eq .Page.Title "Notes") -}}
|
{{- if or (eq .context.Page.Section "notes") (eq .context.Page.Title "Notes") -}}
|
||||||
{{- $isNotes = true -}}
|
{{- $isNotes = true -}}
|
||||||
{{- $action = "Noted" -}}
|
{{- $action = "Noted" -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- $needsModTime := gt (sub .Lastmod.Unix .Date.Unix) 900 -}}
|
{{- $needsModTime := gt (sub .context.Lastmod.Unix .context.Date.Unix) 900 -}}
|
||||||
{{- $needsList := or (and (not $shortMeta) $needsModTime) (not $isNotes) -}}
|
{{- $needsList := or (and (not $shortMeta) $needsModTime) (not $isNotes) -}}
|
||||||
{{- $gemini := "" }}
|
{{- $gemini := "" }}
|
||||||
{{- with .OutputFormats.Get "gemtext" -}}
|
{{- with .context.OutputFormats.Get "gemtext" -}}
|
||||||
{{- $gemini = replace .Permalink "/gemini" "" 1 | safeURL -}}
|
{{- $gemini = replace .Permalink "/gemini" "" 1 | safeURL -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- if not (eq .Page.Section "posts" ) -}}
|
{{- if not (eq .context.Page.Section "posts" ) -}}
|
||||||
{{- $gemini = replace $gemini "/index.gmi" ".gmi" | safeURL -}}
|
{{- $gemini = replace $gemini "/index.gmi" ".gmi" | safeURL -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- if $needsList }}
|
{{- if $needsList }}
|
||||||
|
@ -25,16 +25,16 @@
|
||||||
<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 {{ 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 -}}.
|
{{- $action }} <time{{ if not (.context.Params.evergreen) }} itemprop="dateCreated datePublished" class="dt-published published"{{ end }} datetime="{{ .context.Date.UTC.Format "2006-01-02T15:04:05Z07:00" }}">{{ .context.Date.UTC.Format "2006-01-02" }}</time> by {{ partialCached "indieweb-author.html" .context -}}{{ if not .isList }} on his <a rel="canonical" itemprop="url" class="u-url url" href="{{ .context.Site.Params.CanonicalBaseURL }}{{ $canonicalRelPermalink }}">Website</a>{{- with .context.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 .context.Lastmod.Unix .context.Date.Unix) 900 -}}
|
||||||
{{ if $needsList }}<li>{{ end }}
|
{{ if $needsList }}<li>{{ end }}
|
||||||
Last updated <time itemprop="dateModified" class="dt-updated updated" datetime="{{ .Lastmod.UTC.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Lastmod.UTC.Format "2006-01-02" }}</time>.{{ if not $shortMeta }} <a href="{{ $logURL }}">Changelog</a>{{ end }}
|
Last updated <time itemprop="dateModified" class="dt-updated updated" datetime="{{ .context.Lastmod.UTC.Format "2006-01-02T15:04:05Z07:00" }}">{{ .context.Lastmod.UTC.Format "2006-01-02" }}</time>.{{ if not .isList }} <a href="{{ $logURL }}">Changelog</a>{{ end }}
|
||||||
{{ if $needsList }}</li>{{ end }}
|
{{ if $needsList }}</li>{{ end }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- if not $isNotes -}}
|
{{- if not $isNotes -}}
|
||||||
{{ if $needsList }}<li>{{ else }}<br />{{ end }}
|
{{ if $needsList }}<li>{{ else }}<br />{{ end }}
|
||||||
{{ partial "post-meta/wordcount.html" . -}}
|
{{ partial "post-meta/wordcount.html" .context -}}
|
||||||
{{ if $needsList }}</li>{{ end }}
|
{{ if $needsList }}</li>{{ end }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- if $needsList }}
|
{{- if $needsList }}
|
||||||
|
|
Loading…
Reference in a new issue