From 7f421830c54d0accc640dc30200374c2fa98f6cc Mon Sep 17 00:00:00 2001 From: Ben Goldsworthy Date: Wed, 4 Jun 2025 17:48:08 +0200 Subject: [PATCH] use partial for site footer info --- layouts/_default/baseof.html | 26 ++++++++++++-------- layouts/partials/footer/text.html | 40 +++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 layouts/partials/footer/text.html diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 836089e..0aac68c 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -13,14 +13,14 @@ {{- partialCached "head/meta.html" . -}} - {{- block "title" . -}} + {{- block "title" . -}} {{- partialCached "head/title.html" ( slice .Site.Title .Site.Params.tagline ) .Site.Title .Site.Params.tagline -}} - {{- end -}} - + {{- end -}} + {{- partialCached "head/references.html" ( dict "sc" $ "pc" . ) -}} -

- By {{ $.Site.Params.Author.name }} | - Report an Issue | - Privacy Policy | Sitemap | Built: - {{ now.Format "2006-01-02T15:04:05" }} -

+ {{- + partialCached + "footer/text.html" + ( dict + "author_name" .Site.Params.Author.name + "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 }} {{- end -}} diff --git a/layouts/partials/footer/text.html b/layouts/partials/footer/text.html new file mode 100644 index 0000000..75ea789 --- /dev/null +++ b/layouts/partials/footer/text.html @@ -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. + */ +-}} + + + +{{- 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 -}} + + + +

+ By {{- .author_name -}} | + Report an Issue | + Privacy Policy | + Sitemap | + Built: {{ .last_build_time -}} +