Destination Path via Front Matter
When defined in the front matter, the slug can take the place of the filename for the destination.
title: New Post
This will render to the following destination according to Hugo’s default behavior:
section is determined by a content’s location on disk and cannot be specified in the front matter.
A content’s type is also determined by its location on disk but, unlike section, it can be specified in the front matter. This can come in especially handy when you want a piece of content to render using a different layout. In the following example, you can create a layout at
layouts/new/mylayout.html that Hugo will use to render this piece of content, even in the midst of many other posts.
title: My Post
path can be provided in the front matter. This will replace the actual path to the file on disk. Destination will create the destination with the same path, including the section.
A complete URL can be provided. This will override all the above as it pertains to the end destination. This must be the path from the
baseURL (starting with a
url will be used exactly as it provided in the front matter and will ignore the
--uglyURLs setting in your site configuration:
title: Old URL
baseURL is configured to
https://yoursite.com, the addition of
url to the front matter will make
old-url.md render to the following destination:
You can see more information on how to control output paths in URL Management.