Hello.
I am building a website using the hugo academic theme.
Currently many pages list author at the bottom with a link. I would like to remove this for at least some pages.
How can I do this?
Thanks,
john
Hello.
I am building a website using the hugo academic theme.
Currently many pages list author at the bottom with a link. I would like to remove this for at least some pages.
How can I do this?
Thanks,
john
You could add a param in your content front matter (assuming YAML), say:
showFooter: false
Then in the relevant layout template (it’ll be one the of the single.html
), do something like:
{{ if eq .Params.showFooter true }}
{{ partial "footer_container.html" . }}
{{ partial "footer.html" . }}
{{ end }}
cc @neutreno
Thanks that’s very helpful.
So I suppose the single.html files you’re referring to would be e.g.
thub.com/gcushen/hugo-academic/blob/master/layouts/project/single.html
Do you know if it is it possible to add the customization you described without modifying the theme template files themselves (i.e. the submodule in my website repo themes/
folder), but using configuration options from within the main website repo?
Thanks.
You can override theme templates. So copy
your-site/themes/academic/layouts/project/single.html
And paste to
your-site/layouts/project/single.html
Then make your changes.
Keep in mind that you need to check if the param is set to avoid error. I implemented the same idea like this:
{{ if ne $.Params.options.hideFooter true ) }}
{{ partial “footer.html” . }}
{{ end }}