Hello there,
so I have a (simply cosmetic ) issue with intendation.
I’m pretty sure this is easily fixable, but I’m not sure what’s the actual problem and haven’t found issues similar to mine.
The necessary code is here.
Basically, the automagically created (with opengraph and twitter cards) meta tags aren’t in line.
Thanks for helping!
How is that an issue? It’s code that your browser interprets. Your visitors will never see that code (except for them being developers and interested in what you are doing under the hood).
The problem is, that the used partials to generate the code don’t know what indentation the layout file that calls them had. There is no way to say “hey Hugo, load partial X and by the way we are 2 tabs in right now” and Hugo indents properly. It’s basically, from a point of how Hugo runs through layout files, impossible to know that at that point.
If your OCD requires you to have perfectly indented HTML code, then you will have to use a post processing script that beautifies your code AFTER Hugo is done with it.
If you however want to give your visitors the best experience you remove any hint of white space in the code to make it as small and fast transferred through the inter-tubes as possible.
Decisions…
Yeah, as mentioned, it isnt a real issue, I just wanted it to look nice.
If your OCD requires you to have perfectly indented HTML code
It’s basically this, but then again I’m too lazy to reformat/beautifies it every time.
If you however want to give your visitors the best experience you remove any hint of white space in the code to make it as small and fast transferred through the inter-tubes as possible.
How would this be done? Always loving some optimizing for the inter-tubes
Quickstart: run hugo --minify
instead of just hugo
.
The long road would be to read into the Golang docs… Whenever you have a {{
you could have a {{-
which basically strips all whitespace LEFT of the {{
. Same on the right side. I am working much with all these stripping delimiters. But hugo --minify
should be the beginning.
If you want to minify CSS and JS you can do so too via Hugo Pipes.
Alright, coolio! Thanks for all the help.