Use these tokens when defining the URL pattern. The date field in front matter determines the value of time-related tokens.
the 4-digit year
the 2-digit month
the name of the month
the 2-digit day
the 1-digit day of the week (Sunday = 0)
the name of the day of the week
the 1- to 3-digit day of the year
the content’s section
the content’s sections hierarchy. You can use a selection of the sections using slice syntax: :sections[1:] includes all but the first, :sections[:last] includes all but the last, :sections[last] includes only the last, :sections[1:2] includes section 2 and 3. Note that this slice access will not throw any out-of-bounds errors, so you don’t have to be exact.
the content’s title
the content’s slug (or title if no slug is provided in the front matter)
the content’s slug (or file name if no slug is provided in the front matter)
the content’s file name (without extension)
For time-related values, you can also use the layout string components defined in Go’s time package. For example:
The appearance of a URL is either ugly or pretty.
By default, Hugo produces pretty URLs. To generate ugly URLs, change your site configuration:
Hugo provides two mutually exclusive configuration options to alter URLs after it renders a page.
If enabled, Hugo performs a search and replace after it renders the page. It searches for site-relative URLs (those with a leading slash) associated with action, href, src, srcset, and url attributes. It then prepends the baseURL to create absolute URLs.
This is an imperfect, brute force approach that can affect content as well as HTML attributes. As noted above, this is a legacy configuration option that will likely be removed in a future release.
If enabled, Hugo performs a search and replace after it renders the page. It searches for site-relative URLs (those with a leading slash) associated with action, href, src, srcset, and url attributes. It then transforms the URL to be relative to the current page.