{{- /*
Content file -> the commit it was last changed in, handed to the build in
HUGO_PARAMS_PAGECOMMITS because the sandbox has no git to ask (see
scripts/page-commits.sh). Empty for a plain `nix build`, and missing an
entry for any page git has not seen yet, so every lookup needs a fallback:
site.Params.repoCommit, the revision the site itself was built from. That
in turn is a branch name when there was no revision to name, which is not a
hash and is not shown as one - hence the length test rather than a bare
`with`.
*/}}
{{- $pageCommits := dict }}
{{- with site.Params.pagecommits }}
{{- $pageCommits = transform.Unmarshal . }}
{{- end }}
{{- /*
Source link for the page you are reading. It points at the branch rather
than at a revision: "improve this page" is an invitation to edit the file,
so it lands on the version you would actually edit, and the branch is
something the forge can always resolve - a revision only resolves once it
has been pushed. The hash beside it names the commit this page was last
changed in, which is what the reader is looking at. The two can disagree
for as long as a change is pushed but not deployed.
Pages Hugo generates without a content file - the home page, the post list
- have no .File, and get no link.
*/}}
{{- with .File }}
{{- $source := path.Join site.Params.repoContentPath .Path }}
{{- $stamp := or (index $pageCommits .Path) site.Params.repoCommit }}
{{ i18n "improvePage" }}{{ if eq (len $stamp) 40 }} @ {{ substr $stamp 0 7 }}{{ end }}·
{{- end }}
{{ i18n "licenseText" }} CC BY-SA·
{{ i18n "rssLabel" }}
{{- $translations := .AllTranslations }}
{{- if gt (len $translations) 1 }}
{{- /*
"Turnstile Language Icon" by Farhat Datta (A' Design Award 2011,
languageicon.org), traced coordinates rounded to 2 decimals - already
single-color, so fill:currentColor (in CSS, not per-path) is enough
to match the RSS icon's convention. Sized larger than that icon (see
.lang-switch svg) since its finer detail (the two characters, the
arrow) turns to mush at the RSS icon's ~0.85em.
*/}}
{{- range sort $translations "Language.Weight" }}
{{- if ne .Lang $.Lang }}
{{ .Language.Label }}
{{- end }}
{{- end }}
{{- end }}
{{ with site.Params.nixstorepath }}
{{ . }}
{{ end }}