From: Anthony Fok <foka@debian.org> Date: Wed, 21 Jan 2015 06:45:26 +0000 (-0700) Subject: [Docs] Recommend the use of backticks for IE conditionals X-Git-Tag: v0.13~139 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=f015e9b8;p=brevno-suite%2Fhugo [Docs] Recommend the use of backticks for IE conditionals Special thanks to @tatsushid and @bjornerik for the insight! Fixes #778. --- diff --git a/docs/content/templates/go-templates.md b/docs/content/templates/go-templates.md index ccfa3a96..056f78e9 100644 --- a/docs/content/templates/go-templates.md +++ b/docs/content/templates/go-templates.md @@ -240,6 +240,12 @@ By default, Go Templates remove HTML comments from output. This has the unfortun <script src="html5shiv.js"></script> {{ "<![endif]-->" | safeHtml }} +Alternatively, use the backtick (`` ` ``) to quote the IE conditional comments, avoiding the tedious task of escaping every double quotes (`"`) inside, as demonstrated in the [examples](http://golang.org/pkg/text/template/#hdr-Examples) in the Go text/template documentation, e.g.: + +``` +{{ `<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7"><![endif]-->` | safeHtml }} +``` + ## Context (a.k.a. the dot) The most easily overlooked concept to understand about Go templates is that `{{ . }}`