Closed djanda97 closed 1 year ago
Reading the templates/macros/title.html file, shouldn't the title fallback to {{ main_title }}
if a user hasn't set a value for config.extra.page_titles
instead of failing to build?
Using Zola version 0.17.2
Hey, yes, absolutely right. This config entry shouldn't be required, and the theme should fallback to {{ main_title }}
.
Looks like this is easily fixed by changing the way the title macro accesses this config entry. Something like this seems to do the trick:
-{%- if config.extra.page_titles == "combined" -%}
+{%- if config.extra.page_titles and config.extra.page_titles == "combined" -%}
...
-{%- elif config.extra.page_titles == "page_only" -%}
+{%- elif config.extra.page_titles and config.extra.page_titles == "page_only" -%}
Would you be OK with contributing this fix in a pull request? I'd be happy to merge it.
Gladly! I'll open a PR with the suggested fix :smile:
Hello,
I'm interested in using this theme for my blog but I ran into an issue during setup. I successfully added the theme via the
git submodule add https://github.com/pawroman/zola-theme-terminimal.git themes/terminimal
command and added thetheme = "terminimal"
value to myconfig.toml
file. The issue that I encountered occurred when trying to runzola serve
:For reference, this is the content of the
content/_index.md
file, showing that thetemplate
andpage_template
values are set to their respective files under theterminimal/templates/
directory:In the
themes/terminimal/config.toml
file there is a default value for thepage_titles
variable, however it seems that it is not being recognized. I found a workaround in order for the site to be successfully served by settingpage_titles = "combined"
under the[extra]
section in myconfig.toml
file, but I'm not sure if it is the indented behavior for a user to be required to set this value.Thanks, David