github.com/lyeb/hugo@v0.47.1/docs/content/en/functions/with.md (about)

     1  ---
     2  title: with
     3  # linktitle: with
     4  description: Rebinds the context (`.`) within its scope and skips the block if the variable is absent.
     5  godocref:
     6  date: 2017-02-01
     7  publishdate: 2017-02-01
     8  lastmod: 2017-03-12
     9  categories: [functions]
    10  menu:
    11    docs:
    12      parent: "functions"
    13  keywords: [conditionals]
    14  signature: ["with INPUT"]
    15  workson: []
    16  hugoversion:
    17  relatedfuncs: []
    18  deprecated: false
    19  ---
    20  
    21  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.
    22  
    23  The following example checks for a [user-defined site variable](/variables/site/) called `twitteruser`. If the key-value is not set, the following will render nothing:
    24  
    25  {{< code file="layouts/partials/twitter.html" >}}
    26  {{with .Site.Params.twitteruser}}<span class="twitter">
    27  <a href="https://twitter.com/{{.}}" rel="author">
    28  <img src="/images/twitter.png" width="48" height="48" title="Twitter: {{.}}"
    29   alt="Twitter"></a>
    30  </span>{{end}}
    31  {{< /code >}}