mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-25 22:00:58 +02:00
[Docs] Recommend the use of backticks for IE conditionals
Special thanks to @tatsushid and @bjornerik for the insight! Fixes #778.
This commit is contained in:
@@ -240,6 +240,12 @@ By default, Go Templates remove HTML comments from output. This has the unfortun
|
|||||||
<script src="html5shiv.js"></script>
|
<script src="html5shiv.js"></script>
|
||||||
{{ "<![endif]-->" | safeHtml }}
|
{{ "<![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)
|
## Context (a.k.a. the dot)
|
||||||
|
|
||||||
The most easily overlooked concept to understand about Go templates is that `{{ . }}`
|
The most easily overlooked concept to understand about Go templates is that `{{ . }}`
|
||||||
|
Reference in New Issue
Block a user