From de7d96fa286c97fc446fbf60367de1cb6d9d07ad Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Mon, 3 May 2021 08:06:02 -0700 Subject: [PATCH] Document Go template's multiline support Closes #764 --- content/en/templates/introduction.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/content/en/templates/introduction.md b/content/en/templates/introduction.md index 17fa5475c..fd34842d4 100644 --- a/content/en/templates/introduction.md +++ b/content/en/templates/introduction.md @@ -68,6 +68,22 @@ Accessing the Page Parameter `bar` defined in a piece of content's [front matter {{ if or (isset .Params "alt") (isset .Params "caption") }} Caption {{ end }} ``` +#### A Single Statement Can be Split over Multiple Lines + +```go-html-template +{{ if or + (isset .Params "alt") + (isset .Params "caption") +}} +``` + +#### Raw String Literals Can Include Newlines + +```go-html-template +{{ $msg := `Line one. +Line two.` }} +``` + ## Variables {#variables} Each Go Template gets a data object. In Hugo, each template is passed