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 new "partials" syntax for pegasus templates #28118
Conversation
also see #28120 for an example of the kind of conversion we'd want to apply to all our markdown templates under such a scheme |
…n our file hierarchy
# | ||
# Because such content can be translated, we want to make sure that if a | ||
# translator accidentally translates the path to the template, we simply | ||
# render nothing rather than throwing an error |
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.
It is worth tracking these errors somewhere (not sure how)? We could occasionally go through all of the invalid template paths and fix any caused by translations.
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.
Oh, I like that! We could probably register a honeybadger error here but still show the page. I'll add a Jira item for this.
Specifically, pegasus templates that use a rendering engine that does not have native support for partials (particularly markdown).
The implementation simply requires you to add the new extension
partial
to the file, then you can include any partial within theviews
directory with the syntax{{ * }}
, where*
can be the (extensionless) name of any existing partial. The contents of the partial will be included in the template file upon render.For example, renaming
hints.md
tohints.md.partial
and adding{{ testimonials }}
tohints.md
results in:Also add protection against directory transversal in our template rendering in general; we already sort of protect against this by escaping periods in URIs, but we don't currently protect against this in the existing
view
tags.