-
Notifications
You must be signed in to change notification settings - Fork 963
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
Add default template warning #2205
base: next
Are you sure you want to change the base?
Add default template warning #2205
Conversation
* Reuse Client when checking urls and add timeout for requests
* Implement replace_re filter * Cargo fmt * add regex caching * cargo fmt * update docs, update unit test * rename replace_re -> regex_replace
Relative links in the entry content do not currently have a base URI, so will be resolved relative to the feed URI: Given an entry with the content: <a href="some-resource.bin"> And URIS of: * entry: https://example.org/blog/some-entry/ * feed: https://example.org/atom.xml The link URI will end up as: https://example.org/some-resource.bin rather than the URI that ends up resolved in the rendered page: https://example.org/blog/some-entry/some-resource.bin The atom and RSS formats allow for an xml:base attribute (itself specified in [1]) to provide a base URI of a subset of a document. This change adds xml:base attributes to each entry, using the page permalink. This gives us something equivalent to: <entry> <content xml:base="https://example.org/blog/some-entry/"> <![CDATA[ <a href="some-resource.bin"> ]]> </content> </entry> [1]: https://www.w3.org/TR/xmlbase/ Signed-off-by: Jeremy Kerr <[email protected]>
@@ -100,6 +100,16 @@ pub fn render_template( | |||
} | |||
} | |||
|
|||
pub fn is_default_template(name: &str, tera: &Tera, theme: &Option<String>) -> Result<bool> { |
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's not the right place to check. You essentially need to search for templates with that name in a theme or the templates directory Tera instances. Only if there are no overrides should the message be shown. Another way to do it would be to have a log
Tera functions that does println so the template itself can warn
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.
You essentially need to search for templates with that name in a theme or the templates directory Tera instances. Only if there are no overrides should the message be shown.
Sorry, I thought I had accomplished this with this function which uses check_template_fallbacks. I will think on this but I am currently confused as to how to do this differently without repeating the logic in check_template_fallbacks.
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.
How do I do this without repeating logic in check_template_fallbacks?
8b1a413
to
67c2fe0
Compare
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:
Rewrite of #2200
This should be less ugly with way fewer lock acquisitions, and it actually works for
zola check
.I have only done some simple manual tests so far.