use partial for site footer info

This commit is contained in:
Ben Goldsworthy 2025-06-04 17:48:08 +02:00
parent 8ec94d7296
commit 7f421830c5
No known key found for this signature in database
2 changed files with 56 additions and 10 deletions

View file

@ -13,13 +13,13 @@
<!-- Meta --> <!-- Meta -->
{{- partialCached "head/meta.html" . -}} {{- partialCached "head/meta.html" . -}}
<meta <meta
name="description" name="description"
content="{{- block "head-description" . -}}{{- $.Site.Params.description | html -}}{{- end -}}" content="{{- block "head-description" . -}}{{- $.Site.Params.description | html -}}{{- end -}}"
/> />
{{- block "title" . -}} {{- block "title" . -}}
{{- partialCached "head/title.html" ( slice .Site.Title .Site.Params.tagline ) .Site.Title .Site.Params.tagline -}} {{- partialCached "head/title.html" ( slice .Site.Title .Site.Params.tagline ) .Site.Title .Site.Params.tagline -}}
{{- end -}} {{- end -}}
<!-- References --> <!-- References -->
{{- partialCached "head/references.html" ( dict "sc" $ "pc" . ) -}} {{- partialCached "head/references.html" ( dict "sc" $ "pc" . ) -}}
@ -66,12 +66,18 @@
{{- block "footer" . -}} {{- block "footer" . -}}
<footer class="site-footer"> <footer class="site-footer">
<p> {{-
By <a href="/">{{ $.Site.Params.Author.name }}</a> | partialCached
<a href="{{ $.Site.Params.codeURL }}{{ $.Site.Params.reportIssueURL }}">Report an Issue</a> | "footer/text.html"
<a href="{{ relref . "privacy-policy" }}">Privacy Policy</a> | <a href="/{{ .Sitemap.Filename }}">Sitemap</a> | Built: ( dict
{{ now.Format "2006-01-02T15:04:05" }} "author_name" .Site.Params.Author.name
</p> "report_issue_url" ( printf "%s%s" .Site.Params.codeURL .Site.Params.reportIssueURL )
"privacy_policy_url" ( relref . "privacy-policy" )
"sitemap_path" ( printf "/%s" .Sitemap.Filename )
"last_build_time" ( now.Format "2006-01-02T15:04:05" )
)
-}}
{{ block "footer-scripts" . }}<!-- -->{{ end }} {{ block "footer-scripts" . }}<!-- -->{{ end }}
</footer> </footer>
{{- end -}} {{- end -}}

View file

@ -0,0 +1,40 @@
{{- /*
Returns the site footer text.
@params licences_data Site data of licences, indexed by SPDX IDs.
@params licence Licence identifier.
@params licence_link Manually-defined licence URL. Optional.
*/
-}}
<!-- Validation -->
{{- if ( not ( isset . "author_name" ) ) -}}
{{- errorf "No site author defined" -}}
{{- end -}}
{{- if ( not ( isset . "report_issue_url" ) ) -}}
{{- errorf "No 'Report Issue' URL defined" -}}
{{- end -}}
{{- if ( not ( isset . "privacy_policy_url" ) ) -}}
{{- errorf "No 'Privacy Policy' URL defined" -}}
{{- end -}}
{{- if ( not ( isset . "sitemap_path" ) ) -}}
{{- errorf "No sitemap path defined" -}}
{{- end -}}
{{- if ( not ( isset . "last_build_time" ) ) -}}
{{- errorf "No last build time defined" -}}
{{- end -}}
<!-- Rendering -->
<p>
By <a href="/">{{- .author_name -}}</a> |
<a href="{{- .report_issue_url -}}">Report an Issue</a> |
<a href="{{- .privacy_policy_url -}}">Privacy Policy</a> |
<a href="{{- .sitemap_path -}}">Sitemap</a> |
Built: {{ .last_build_time -}}
</p>