I’m stuck while trying to do a very easy thing: I need to comment a line in a template file (specifically layouts/index.html).
As far as I can see from golang template, I should use //, but I get this error:
Rendering error: html/template: "index.html" is an incomplete template
I tried also HTML and CSS comments but it didn’t work.
It seems both traditional HTML <!-- blah blah blah //--> and Go Template style coments {{ "<!-- blah blah blah //-->" | safeHtml }} get stripped out of shortcode templates.
Actually,on further inspection, that’s not strictly true. The youtube.html and vimeo.html shortcodes preserve comments written using the go template syntax, whereas thre img.html shortcode strips them out in whatever format they’re written.
Well that depends on who you ask. If I ask Homebrew [which I installed Hugo with], it thinks it’s Version 0,12:
hugo: stable 0.12 (bottled), HEAD
http://hugo.spf13.com/
/usr/local/Cellar/hugo/0.12 (5 files, 22M) *
Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/hugo.rb````
But if I ask Hugo itself, it seems to think it's Version 0,13DEV:
````$: hugo version
Hugo Static Site Generator v0.13-DEV````
/usr/local/bin/hugo````
which is Homebrew's symlinked one:
````$: ls -al /usr/local/bin/hugo*
lrwxr-xr-x 1 madra admin 28 14 Dec 21:08 /usr/local/bin/hugo -> ../Cellar/hugo/0.12/bin/hugo
lrwxr-xr-x 1 madra admin 33 14 Dec 21:08 /usr/local/bin/hugo-0.12 -> ../Cellar/hugo/0.12/bin/hugo-0.12````
Ah... wait a min. Looks like for some reason Homebrew as installed ````0.13DEV```` as plain ol' "hugo" and ````0,12```` as "hugo-0.12", so I should be able to explicitly run 0.12 by using *hugo-0.12* as the command, rather than *hugo*.
I wonder how that happened?
**UPDATE:**
OK. Just to confirm, neither *0,12* or *0,13-DEV* preserve comments in the *img.html* shortcode template
I have now tested it with the latest 0.13-DEV and it works fine for me (that is, the comments are preserved).
I haven’t tested it with 0.12, but I understand why it wouldn’t work there.
The shorctode handling has been rewritten in 0.13. In 0.12 it would go twice through template/markdown processing, and the comment would survive once, but not twice … In 0.13 this shouldn’t be an issue.
EDIT IN: Dont’ ask me aboout Brew/Homebrew, I have no clue. I’m a Linux person.
Comments are good! The average site audience doesn’t see the comments. The persons who see the comments are interesting in the way the things are build, so that’s clearly for them.
Websites are full of images, audios and videos. The textual comments will not add lots of bytes.
Why the comments missed me?
I tried to undestand which of the theme’s source was used for my index.md pages. So I added some comments in the .htlm sources in the theme’s directory to identify them.
I lost lot of time trying to identify the good source, before seing this post and understanding that the comments where just deleted.
I had to range over a huge CSV file > 50K lignes.
I had to make comment (html style for colorization in my editor) in my code and wanted to remove the unnecessary white lines who bloated the resulting HTML