mirror of
https://github.com/gohugoio/hugo.git
synced 2026-09-03 04:02:38 +00:00
835 B
835 B
title, linktitle, description, godocref, date, publishdate, lastmod, categories, tags, signature, workson, hugoversion, relatedfuncs, deprecated
| title | linktitle | description | godocref | date | publishdate | lastmod | categories | tags | signature | workson | hugoversion | relatedfuncs | deprecated | |||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| with | 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 the "if" 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:
{{% code file="layouts/partials/twitter.html" %}}
{{with .Site.Params.TwitterUser}}<span class="twitter">
<a href="https://twitter.com/{{.}}" rel="author">
<img src="/images/twitter.png" width="48" height="48" title="Twitter: {{.}}"
alt="Twitter"></a>
</span>{{end}}
{{% /code %}}