diff --git a/docs/_docs/permalinks.md b/docs/_docs/permalinks.md index 31eeb30b..d41d6162 100644 --- a/docs/_docs/permalinks.md +++ b/docs/_docs/permalinks.md @@ -4,27 +4,62 @@ title: Permalinks permalink: /docs/permalinks/ --- -Jekyll supports a flexible way to build your site’s URLs. You can specify the -permalinks for your site through the [Configuration](../configuration/) or in -the [YAML Front Matter](../frontmatter/) 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`. +Jekyll supports a flexible way to build the permalinks for your pages, posts, and collections. A permalink is the URL for the page, post, or collection (excluding the domain name or directory folder). -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 according to the format `/:categories/:year/:month/:day/:title.html`. +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. +You’re free to construct your own permalink style using the available template variables or choose one of the built-in permalink styles (such as `date`) that automatically use a template-variable pattern. + +## 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/`. + +{% comment %}this note needs clarification
- Built-in permalink styles are not recognized in YAML Front Matter. So
- permalink: pretty
will not work, but the equivalent
- /:categories/:year/:month/:day/:title/
- using template variables will.
-
Built-in permalink styles are not recognized in YAML Front Matter. As a result, permalink: pretty
will not work, but the equivalent /:categories/:year/:month/:day/:title/
using template variables will.
- Year from the Post’s filename +Year from the post's filename |
- Month from the Post’s filename +Month from the post's filename |
- Month from the Post’s filename without leading zeros. +Month from the post's filename without leading zeros. |
- Day from the Post’s filename +Day from the post's filename |
- Day from the Post’s filename without leading zeros. +Day from the post's filename without leading zeros. |
- Year from the Post’s filename without the century. +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 |
@@ -109,7 +144,7 @@ permalink is defined according to the format `/:categories/:year/:month/:day/:ti
- Second of the minute from the post’s |
@@ -130,8 +165,8 @@ permalink is defined according to the format `/:categories/:year/:month/:day/:ti
- Slugified title from the document’s filename ( any character
- except numbers and letters is replaced as hyphen ). May be
+ Slugified title from the document’s filename (any character
+ except numbers and letters is replaced as hyphen). May be
overridden via the document’s |
@@ -142,7 +177,7 @@ permalink is defined according to the format `/:categories/:year/:month/:day/:ti
- The specified categories for this Post. If a post has multiple
+ The specified categories for this post. If a post has multiple
categories, Jekyll will create a hierarchy (e.g. |