jekyll/site/docs/permalinks.md

3.9 KiB
Raw Blame History

layout title prev_section next_section permalink
docs Permalinks templates pagination /docs/permalinks/

Jekyll supports a flexible way to build your sites URLs. You can specify the permalinks for your site through the Configuration or in the YAML Front Matter for each post. Youre 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

Year from the Posts filename

month

Month from the Posts filename

i_month

Month from the Posts filename without leading zeros.

day

Day from the Posts filename

i_day

Day from the Posts filename without leading zeros.

short_year

Year from the Posts filename without the century.

title

Title from the Posts filename

categories

The specified categories for this Post. Jekyll automatically parses out double slashes in the URLs, so if no categories are present, it will ignore this.

Permalink Style URL Template

date

/:categories/:year/:month/:day/:title.html

pretty

/:categories/:year/:month/:day/:title/

none

/:categories/:title.html

Given a post named: /2009-04-29-slap-chop.textile

Permalink Setting Resulting Permalink URL

None specified, or permalink: date

/2009/04/29/slap-chop.html

permalink: pretty

/2009/04/29/slap-chop/index.html

permalink: /:month-:day-:year/:title.html

/04-29-2009/slap-chop.html

permalink: /blog/:year/:month/:day/:title

/blog/2009/04/29/slap-chop/index.html