--- title: Permalinks permalink: /docs/permalinks/ --- Permalinks are the output path for your pages, posts, or collections. They allow you to structure the directories of your source code different from the directories in your output. ## Front Matter The simplest way to set a permalink is using front matter. You set the `permalink` variable in front matter to the output path you'd like. For example, you might have a page on your site located at `/my_pages/about-me.html` and you want the output url to be `/about/`. In front matter of the page you would set: ``` --- permalink: /about/ --- ``` ## Global Setting a permalink in front matter for every page on your site is no fun. Luckily, Jekyll let's you set in globally in your `_config.yml`. To set a global permalink, you use the `permalink` variable in `_config.yml`. You can use placeholders to your desired output. For example: ```yaml permalink: /:categories/:year/:month/:day/:title:output_ext ``` Note that pages and collections don't have time or categories, these aspects of the permalink style are ignored for the output. For example, a permalink style of `/:categories/:year/:month/:day/:title:output_ext` for posts becomes `/:title.html` for pages and collections. ### Placeholders Here's the full list of placeholders available:
Variable | Description |
---|---|
|
Year from the post's filename. May be overridden via the document’s
|
|
Month from the post's filename. May be overridden via the document’s
|
|
Month without leading zeros from the post's filename. May be
overridden via the document’s |
|
Day from the post's filename. May be overridden via the document’s
|
|
Day without leading zeros from the post's filename. May be overridden
via the document’s |
|
Day of the year from the post's filename, with leading zeros. |
|
Year without the century from the post's filename. May be overridden
via the document’s |
|
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 front matter. As a result, permalink: pretty
will not work.
Variable | Description |
---|---|
|
Label of the containing collection. |
|
Path to the document relative to the collection's directory. |
|
The document's base filename, with every sequence of spaces and non-alphanumeric characters replaced by a hyphen. |
|
The |
|
Extension of the output file. (Included by default and usually unnecessary.) |