× Home
Create SEO compatible URL with the Hugo Front Matter variable slug.

Hugo - Adjust the URL with the Front Matter variable slug

Adjust the URL with the Hugo Front Matter variable slug.

SEO-compatible URLs must not be too long and should not contain any country-specific special characters. The Hugo generator automatically uses the title of the website as the URL. Spaces are replaced by hyphens when generating. Special characters are included in the URL.

Special characters are recognised by search engines, but it is still more search engine friendly if there are no special characters in a URL. For international display in browsers, the utf8 character set should be selected. This ensures that the characters can be displayed in any language. In the head of my web pages I have the following entry for utf8:

  <meta charset="utf-8">

URL encoding, or percentage encoding, is a mechanism used to encode information in a URL under certain circumstances. A German umlaut, for example ö, is displayed as %C3%B6 after URL encoding. The character can thus also be displayed in other languages. Wikipedia explains the encoding very well - Wikipedia - Percent-encoding .

From an SEO point of view, special characters in the URL are bad. They may not be displayed on the target browser, or they may be displayed incorrectly. Therefore, you should limit the URL to the permitted ASCII characters.

In the title of a website, however, special characters sometimes make sense. If in a German title the word für is replaced by fuer, this looks strange to someone who understands German. The length of a URL is an important criterion for Google. The shorter the better. A length of 50 to 60 characters should not be exceeded.

Hugo Front Matter Variable slug

To allow the URL to be customised in the Hugo Generator, Hugo provides the - Front Matter - variable slug available. With slug the page-specific URL can be shortened and special characters and filler words can be removed.

title: "Hugo - Adjust the URL with the Front Matter variable slug"
slug: "hugo-slug-url-adjust"


I myself have published various websites with special characters and too long URLs due to carelessness. When I finally noticed this, the clean-up, including the entries in search engines, took a lot of work. So it is better to pay attention to this when creating a website.

Link list for this post

2 minutes to read
This post was created with Hugo version 0.91.2.

With the German language setting, comments are not displayed in the English version of the website and vice versa.

© 2022 - Frank Kunert  -  About me
A service from webdienste-kunert.de