Conditional on array length
<ul>
{{ $.Scratch.Set "section" "Articles" }}
{{ if (gt (where .Site.Pages "Section" "post" | len) 0) }}
{{ $.Scratch.Set "section" `<a href="` }}
{{ $.Scratch.Add "section" .Site.BaseURL }}
{{ $.Scratch.Add "section" `post">Articles</a>` }}
{{ end }}
<li>{{ $.Scratch.Get "section" | safeHTML}}</li>
{{ $.Scratch.Set "section" "Links" }}
{{ if (gt (where .Site.Pages "Section" "link" | len) 0) }}
{{ $.Scratch.Set "section" `<a href="` }}
{{ $.Scratch.Add "section" .Site.BaseURL }}
{{ $.Scratch.Add "section" `link">Links</a>` }}
{{ end }}
<li>{{ $.Scratch.Get "section" | safeHTML }}</li>
{{ $.Scratch.Set "section" "Quotes" }}
{{ if (gt (where .Site.Pages "Section" "quote" | len) 0) }}
{{ $.Scratch.Set "section" `<a href="` }}
{{ $.Scratch.Add "section" .Site.BaseURL }}
{{ $.Scratch.Add "section" `quote">Quotes</a>` }}
{{ end }}
<li>{{ $.Scratch.Get "section" | safeHTML }}</li>
</ul>