--- title: urlize # linktitle: urlize description: Takes a string, sanitizes it for usage in URLs, and converts spaces to hyphens. date: 2017-02-01 publishdate: 2017-02-01 lastmod: 2017-02-01 categories: [functions] menu: docs: parent: "functions" keywords: [urls,strings] signature: ["urlize INPUT"] hugoversion: deprecated: false workson: [] relatedfuncs: [] --- The following examples pull from a content file with the following front matter: {{< code file="content/blog/greatest-city.md" copy="false">}} +++ title = "The World's Greatest City" location = "Chicago IL" tags = ["pizza","beer","hot dogs"] +++ {{< /code >}} The following might be used as a partial within a [single page template][singletemplate]: {{< code file="layouts/partials/content-header.html" download="content-header.html" >}}

{{.Title}}

{{ with .Params.location }}
{{.}}
{{ end }} {{ with .Params.tags }} {{ end }}
{{< /code >}} The preceding partial would then output to the rendered page as follows, assuming the page is being built with Hugo's default pretty URLs. {{< output file="/blog/greatest-city/index.html" >}}

The World's Greatest City

Chicago IL
{{< /output >}} [singletemplate]: /templates/single-page-templates/