Back to Hugo

break

docs/content/en/functions/go-template/break.md

0.161.1280 B
Original Source

This template code:

go-html-template
{{ $s := slice "foo" "bar" "baz" }}
{{ range $s }}
  {{ if eq . "bar" }}
    {{ break }}
  {{ end }}
  <p>{{ . }}</p>
{{ end }}

Is rendered to:

html
<p>foo</p>

{{% include "/_common/functions/go-template/text-template.md" %}}