We have been trying to eliminate all of the extra blank lines that appear in the markup of our pages, but I have discovered that most of these are actually coming from comments in the template files.
For example....
Each of those highlighted comments end up as blank lines in the final HTML output. Since each template ends up pulling in more templates, this adds up to a lot of blank lines.
Does anyone know of a way around this? I imagine there isn't, but I thought I should ask.
Views
Replies
Total Likes
Comments - like those should not be rendered in the HTML
Views
Replies
Total Likes
The comments themselves are not rendered, but a blank line is rendered whenever such a comment is encountered in the code. I have verified this by removing the comments in the templates and reloading the resulting page to see the relevant blank lines removed.
I am referring to the extra blank lines that show up in the markup....
Show the rendered HTML - are you seeing whitespace or blank lines?
Views
Replies
Total Likes
I think this is open sling issue. [SLING-4443] Whitespace removal for Sightly HTML output - ASF JIRA
Whitespace Removal from Sightly HTML output
Does the same JSP trick work here? Just remove the newlines from the source.
For example:
<!—
comments here
—><!—
next comment
—><anyhtmltag>
Etc.
If you are delivering content through the dispatcher and it does gzip encoding most of the white space bytes would be removed in the compressed version, so the overhead over the wire would be relatively small.
Sorry, but I don't think I can share the full HTML. The image I posted shows the head, and you can clearly see all the blank lines. Each blank line there actually corresponds to a comment in a template.
I did experiment with doing this, but it didn't seem to work. It really is as if the comment itself ends up as a blank line.
Thanks, Arun. I suppose it could be related, but that depends on whether or not they consider comments the same as other hidden tags. Sure seems like a bug to me and not a new feature!
Views
Likes
Replies
Views
Likes
Replies