White space / Blank space in HTML

I find that where ever there is HUGO logic, that space ends up getting counted as a blank line in the rendered HTML page.

Is there anyway to prevent HUGO from leaving a ton of blank space in the HTML?

have you tried this white space note:

I don’t worry about as I run a gulp task to minify everything.

1 Like

So, without GULP, is there a way to have more control over the HTML output via Hugo?
HTML Tidy?

Did you try the hyphen whitespace trimmer linked to? Is that not meeting your needs?

So, without GULP, is there a way to have more control over the HTML output via Hugo?
HTML Tidy?

Did you visit the link that was posted above? Adding a hyphen inside the double curly braces will trim all whitespace on that side of the templating code.

RTD :smile:

yeah, we have been reading the docs and have been using the hyphen whitespace trimmer.
But still, there are places where we have large blocks of logic and it leaves whitespace in the source.

view-source:https://demo.digitalgov.gov/

I had assumed that there was a way to remove it all together in the HUGO build. Possibly a config value.

Thanks :slight_smile:

I personally don’t worry about it as I use CloudFlare, and that strips out all the whitespace for me.

But yes, on my local version I get the same whitespace issues that you are seeing. (i.e. lots of empty lines).

I am not getting the blocks of whitespace like that in my sites. Where are the templates for that site, @jeremyzilar? Maybe there is something else afoot.

1 Like