Skip to content
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 comments on templates to show where the HTML is coming from #2985

Closed
ralsina opened this issue Mar 15, 2018 · 7 comments
Closed

Add comments on templates to show where the HTML is coming from #2985

ralsina opened this issue Mar 15, 2018 · 7 comments

Comments

@ralsina
Copy link
Member

ralsina commented Mar 15, 2018

For example, it happens that you are trying to edit a theme's index page.

You look at it and ... which template is generating that?

We could add comments in all templates and in blocks so that is explicit.

Sure, it makes the output larger, but if you are minifying html, the comments go away.

@Kwpolska
Copy link
Member

Mako and Jinja have a comment feature. Those do not end up in the source output. We already use them in some places (in particular to specify the file encoding for Mako)

@ralsina
Copy link
Member Author

ralsina commented Mar 16, 2018

Yeah, but I do want them in the output so people trying to make a theme know what template to tweak

@Kwpolska
Copy link
Member

Then it gets a huge 👎 from me. This is completely irrelevant to most people and will look strange to people reading the source, unaware of what it means.

@michaelb42
Copy link
Contributor

In combination with a "draft" and "release" switch this would become really useful while editing themes, templates and changing styles. Applying some kind of "build configuration" to the filters, etc. one could easily choose between different tidy profiles and remove those comments in production builds, generate non-minified or minified css, etc. 👍

@michaelb42
Copy link
Contributor

Hm, just recognized that nikola supports a --conf= option (is it documented somewhere?) that could be used to differentiate between a "draft" and a "release".

@ralsina
Copy link
Member Author

ralsina commented Mar 17, 2018

Could be done as an option enabled/disabled by a switch.

Honestly, trying to do a theme without this is complicated. And I wrote the damned theme engine.

@ralsina ralsina closed this as completed Feb 20, 2025
@aknrdureegaesr
Copy link
Contributor

#3760 will at least offer logging which templates went into which output file (when that has been merged finally, might happen any month now). This is not exactly what was wanted here, but a different approach to roughly the same problem field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants