Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dashes when using partial in Hugo [duplicate]

Tags:

go

hugo

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?

like image 824
Dantcho Avatar asked Sep 20 '25 06:09

Dantcho


1 Answers

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.

like image 170
jfarleyx Avatar answered Sep 22 '25 23:09

jfarleyx