--- title: Permalinks permalink: /docs/permalinks/ --- Permalinks refer to the URLs (excluding the domain name or directory folder) for your pages, posts, or collections. Jekyll supports a flexible way to build permalinks, allowing you to leverage various template variables or choose built-in permalink styles (such as `date`) that automatically use a template-variable pattern. You construct permalinks by creating a template URL where dynamic elements are represented by colon-prefixed keywords. The default template permalink is `/:categories/:year/:month/:day/:title.html`. Each of the colon-prefixed keywords is a template variable. ## Where to configure permalinks You can configure your site's permalinks through the [Configuration]({% link _docs/configuration.md %}) file or in the [Front Matter]({% link _docs/frontmatter.md %}) for each post, page, or collection. Setting permalink styles in your configuration file applies the setting globally in your project. You configure permalinks in your `_config.yml` file like this: ```yaml permalink: /:categories/:year/:month/:day/:title.html ``` If you don't specify any permalink setting, Jekyll uses the above pattern as the default. The permalink can also be set using a built-in permalink style: ```yaml permalink: date ``` `date` is the same as `:categories/:year/:month/:day/:title.html`, the default. See [Built-in Permalink Styles](#builtinpermalinkstyles) below for more options. Setting the permalink in your post, page, or collection's front matter overrides any global settings. Here's an example: ```yaml --- title: My page title permalink: /mypageurl/ --- ``` Even if your configuration file specifies the `date` style, the URL for this page would be `http://somedomain.com/mypageurl/`. When you use permalinks that omit the `.html` file extension (called "pretty URLs") Jekyll builds the file as index.html placed inside a folder with the page's name. For example: ``` ├── mypageurl │ └── index.html ``` With a URL such as `/mypageurl/`, servers automatically load the index.html file inside the folder, so users can simply navigate to `http://somedomain.com/mypageurl/` to get to `mypageurl/index.html`. ## Template variables for permalinks {#template-variables} The following table lists the template variables available for permalinks. You can use these variables in the `permalink` property in your config file.
Variable | Description |
---|---|
|
Year from the post's filename |
|
Month from the post's filename |
|
Month from the post's filename without leading zeros. |
|
Day from the post's filename |
|
Day from the post's filename without leading zeros. |
|
Year from the post's filename without the century. |
|
Hour of the day, 24-hour clock, zero-padded from the post's |
|
Minute of the hour from the post's |
|
Second of the minute from the post's |
|
Title from the document’s filename. May be overridden via
the document’s |
|
Slugified title from the document’s filename (any character
except numbers and letters is replaced as hyphen). May be
overridden via the document’s |
|
The specified categories for this post. If a post has multiple
categories, Jekyll will create a hierarchy (e.g. |
Permalink Style | URL Template |
---|---|
|
|
|
|
|
|
|
|
Built-in permalink styles are not recognized in YAML Front Matter. As a result, permalink: pretty
will not work.
URL Template | Resulting Permalink URL |
---|---|
None specified, or |
|
|
|
|
|
|
|
See Extensionless permalinks with no trailing slashes for details. |
|