mirror of
https://github.com/gohugoio/hugo.git
synced 2026-09-02 19:52:38 +00:00
77578f5bfc
in preparation for adding new translations such as Chinese. Paths for "readfile" shortcode are adjusted accordingly. See #461
1.0 KiB
1.0 KiB
title, description, godocref, date, publishdate, lastmod, categories, menu, keywords, signature, workson, hugoversion, relatedfuncs, deprecated
| title | description | godocref | date | publishdate | lastmod | categories | menu | keywords | signature | workson | hugoversion | relatedfuncs | deprecated | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| with | Rebinds the context (`.`) within its scope and skips the block if the variable is absent. | 2017-02-01 | 2017-02-01 | 2017-03-12 |
|
|
|
|
false |
An alternative way of writing an if statement and then referencing the same value is to use with instead. with rebinds the context (.) within its scope and skips the block if the variable is absent or unset.
The following example checks for a user-defined site variable called twitteruser. If the key-value is not set, the following will render nothing:
{{< code file="layouts/partials/twitter.html" >}}
{{with .Site.Params.twitteruser}}
{{end}}
{{< /code >}}