Regarding the use of whitespace trimming in templates ( {{- *** -}} )


As described in the following section, we can take advantage of the whitespace trimming in Hugo templates.

But my question is… when should I use it?

  • Always
  • Whenever appropriate, except when the template syntax includes some logic ( “if”/“with”/“range”) or includes (“partial”/“template”)

I’d like to know what’s the best practice for using this feature.

in my case I use it almost every time, unless I am troubleshooting some sort of frontend result.

My logic is that if something is using {{- ◊ -}} then it’s “done” and if it’s not, it’s still a work in progress or something I need to think about.