3

I'm trying to build a custom theme for hugo. This is my first time using Go and I was wondering what are the dashes in the code below?

{{- partial "head.html" . -}}

Here is the whole file if needed:

<!DOCTYPE html>
<html>
    {{- partial "head.html" . -}}
    <body>

        <div id="content">
        {{- block "main" . }}{{- end }}
        </div>
        {{- partial "footer.html" . -}}
    </body>
</html>

Are the dashes there for any reason and if yes when should I use them?

Dantcho
  • 301
  • 3
  • 14

1 Answers1

2

Per the documentation here: https://gohugo.io/templates/introduction/#whitespace

Go 1.6 includes the ability to trim the whitespace from either side of a Go tag by including a hyphen (-) and space immediately beside the corresponding {{ or }} delimiter.

jfarleyx
  • 775
  • 1
  • 5
  • 9