-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow empty templates dir #2153
Allow empty templates dir #2153
Conversation
707345d
to
aa72263
Compare
components/templates/src/lib.rs
Outdated
@@ -47,8 +47,15 @@ pub fn load_tera(path: &Path, config: &Config) -> Result<Tera> { | |||
|
|||
// Only parsing as we might be extending templates from themes and that would error | |||
// as we haven't loaded them yet | |||
let mut tera = | |||
Tera::parse(&tpl_glob).context("Error parsing templates from the /templates directory")?; | |||
let mut tera = match Tera::parse(&tpl_glob) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have the path from above. We can just join templates
and see if it exists. If it does then we load Tera with the glob otherwise Tera::default()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be a little more straight forward.
c77dfe2
to
7b2ae17
Compare
I still believe this issue is best fixed on tera's side. If you look at the bottom of Keats/tera#819, you can already see quite an enormous amount of reverse references to repos where this change caused a regression. @Keats Perhaps it is best to rethink this and to allow globs over non-existing directories to return the empty set again. After all this is how it is done in most of other languages and sometimes following widely established conventions is more important than a personal strong opinion about some behaviour. ;) |
We can fix it in Tera, I didn't see the number of reverse mentions |
Hey, encountering issues with this. Since tera had already fixed and merged this in (and i believe its published with the latest version of tera), can we upgrade tera to latest to address the issue? |
It's already upgraded in the next branch |
Currently still having issues with 0.17.2 on CI, is it scheduled for the next release? |
Currently zola is still using tera 1.18.1, which is the problematic version: Line 3537 in 9ae7d15
You need to upgrade to tera 1.19.0 by running |
IMPORTANT: Please do not create a Pull Request adding a new feature without discussing it first.
The place to discuss new features is the forum: https://zola.discourse.group/
If you want to add a new feature, please open a thread there first in the feature requests section.
Sanity check:
Code changes
(Delete or ignore this section for documentation changes)
next
branch?If the change is a new feature or adding to/changing an existing one:
This will fix #2150.