Permalinks
Jekyll supports a flexible way to build your site’s URLs. You can specify the
permalinks for your site through the Configuration or in the
YAML Front Matter for each post. You’re free to choose one of
the built-in styles to create your links or craft your own. The default style is
date
.
Permalinks are constructed by creating a template URL where dynamic elements are
represented by colon-prefixed keywords. For example, the default date
permalink is defined as /:categories/:year/:month/:day/:title.html
.
Template variables
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. |
|
Title from the Post’s filename |
|
The specified categories for this Post. If a post has multiple
categories, Jekyll will create a hierarchy (e.g. |
Built-in permalink styles
Note: these may only apply to posts, not to pages, collections or
static files. For example, pretty
changes page permalinks from
/:path/:basename:output_ext
to /:page/:basename/
if the page is HTML,
thus “prettyifying” the page permalink. The date
, none
, and all custom
values do not apply to pages. No permalink style applies to static files,
and collections have their own means of specifying permalinks. It’s all
rather confusing but check out Issue #2691
for more background on the subject, and submit a PR if you’re adventurous
enough to fix it all!
Permalink Style | URL Template |
---|---|
|
|
|
|
|
|
Permalink style examples
Given a post named: /2009-04-29-slap-chop.textile
URL Template | Resulting Permalink URL |
---|---|
None specified, or |
|
|
|
|
|
|
|