-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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 mixed text/html templates #3273
Comments
Sounds like a logical step forward. Can't think of any security issues. Gotchas depend on the implementation. "Shooting From the Hip" proposal: if the name contains a period ( Given
(or whatever the normal lookup order is) |
Most obvius benefit of this is to include CSS partials with css file suffix into HTML templates. A valid workaround would be to rename the file `mystyles.html`, but that doesn't work too good for external editors etc. The css partial is a method used in some themes before Hugo 0.20, but then it stopped working. This commit reintroduces that behaviour. Note that the regular layout lookups for text templates, i.e. "single.json" will be prefixed with "_text/" on lookup and will only match in the text collection. Fixes gohugoio#3273
Most obvius benefit of this is to include CSS partials with css file suffix into HTML templates. A valid workaround would be to rename the file `mystyles.html`, but that doesn't work too good for external editors etc. The css partial is a method used in some themes before Hugo 0.20, but then it stopped working. This commit reintroduces that behaviour. Note that the regular layout lookups for text templates, i.e. "single.json" will be prefixed with "_text/" on lookup and will only match in the text collection. Fixes #3273
Most obvius benefit of this is to include CSS partials with css file suffix into HTML templates. A valid workaround would be to rename the file `mystyles.html`, but that doesn't work too good for external editors etc. The css partial is a method used in some themes before Hugo 0.20, but then it stopped working. This commit reintroduces that behaviour. Note that the regular layout lookups for text templates, i.e. "single.json" will be prefixed with "_text/" on lookup and will only match in the text collection. Fixes #3273
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I lifted this question before, without too much response.
I was reminded by this discussion
https://discuss.gohugo.io/t/hugo-inline-css-optimization-for-google-pagespeed/6032
That the current implementation for custom output types is maybe overly restrictive without any real point.
Right now it is not possible for a HTML template to include a partial that is plain text (defined to be parsed with
text/template
, i.e./layouts/index.html => /layouts/partials/mycss.css
will not work. Note that/layouts/index.html => /layouts/partials/mycss.html
is perfectly fine.I assume that just allowing the above would be useful, and probably work just fine ... Not sure.
Would love to get feedback (any gotchas? security?) before I spend the work on changing this.
/cc @digitalcraftsman @moorereason
The text was updated successfully, but these errors were encountered: