urlencode
The following examples pull from a content file with the following front matter:
content/blog/greatest-city.md
+++
title = "The World's Greatest City"
location = "Chicago IL"
tags = ["pizza","beer","hot dogs"]
+++
The following might be used as a partial within a single page template:
layouts/partials/content-header.html
<header>
<h1>{{.Title}}</h1>
{{ with .Params.location }}
<div><a href="/locations/{{ . | urlencode}}">{{.}}</a></div>
{{ end }}
<!-- Creates a list of tags for the content and links to each of their pages -->
{{ with .Params.tags }}
<ul>
{{range .}}
<li>
<a href="/tags/{{ . | urlencode }}">{{ . }}</a>
</li>
{{end}}
</ul>
{{ end }}
</header>
The preceding partial would then output to the rendered page as follows, assuming the page is being built with Hugo’s default pretty URLs.
/blog/greatest-city/index.html