fix[footer]: allow defining markup language

Custom footer is currently rendered through .RenderString, that defaults
to page's markup language, but page and footer could be written in two
different languages (eg. footer in Markdown and page in Asciidoc). In
this case the footer wouldn't be rendered correctly unless the markup
language used is specified. Now it is possible.
This commit is contained in:
f-dinucci 2022-05-31 22:08:35 +02:00 committed by Giuseppe Masino
parent 994772696a
commit 30ecf2a834
2 changed files with 2 additions and 1 deletions

View File

@ -1,4 +1,5 @@
# Common footer to use site-wide
[[siteFooter]]
text = "Powered by [Hugo](https://gohugo.io/) with [Simple Intro theme](https://github.com/qub1750ul/hugo-simpleIntro) - "
markup = "markdown"
# More footers could be defined to be used in specific pages/layouts

View File

@ -1,7 +1,7 @@
<footer class="text-center mt-8 py-2 bg-gray-900 text-white">
{{ range .Site.Data.site.footers.siteFooter}}
<div>
{{.text | $.RenderString }} &copy; {{ now.Format "2006" }} {{ $.Site.Params.Name }}
{{.text | $.RenderString (dict "markup" .markup)}} &copy; {{ now.Format "2006" }} {{ $.Site.Params.Name }}
</div>
{{end}}
</footer>