mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-02 11:51:30 -05:00
f556cb4414
List all the fields and what they mean, based on hugolib/permalinks.go
53 lines
1.8 KiB
Markdown
53 lines
1.8 KiB
Markdown
---
|
||
aliases:
|
||
- /doc/permalinks/
|
||
date: 2013-11-18
|
||
menu:
|
||
main:
|
||
parent: extras
|
||
next: /extras/shortcodes
|
||
notoc: true
|
||
prev: /extras/menus
|
||
title: Permalinks
|
||
weight: 30
|
||
---
|
||
|
||
By default, content is laid out into the target `publishdir` (public)
|
||
namespace matching its layout within the `contentdir` hierarchy.
|
||
The `permalinks` site configuration option allows you to adjust this on a
|
||
per-section basis.
|
||
This will change where the files are written to and will change the page's
|
||
internal "canonical" location, such that template references to
|
||
`.RelPermalink` will honour the adjustments made as a result of the mappings
|
||
in this option.
|
||
|
||
For instance, if one of your sections is called `post` and you want to adjust
|
||
the canonical path to be hierarchical based on the year and month, then you
|
||
might use:
|
||
|
||
```yaml
|
||
permalinks:
|
||
post: /:year/:month/:title/
|
||
```
|
||
|
||
Only the content under `post/` will be so rewritten.
|
||
A file named `content/post/sample-entry` which contains a line
|
||
`date: 2013-11-18T19:20:00-05:00` might end up with the rendered page
|
||
appearing at `public/2013/11/sample-entry/index.html` and be reachable via
|
||
the URL <http://yoursite.example.com/2013/11/sample-entry/>.
|
||
|
||
The following is a list of values that can be used in a permalink definition,
|
||
all references to time are dependent on the content's date.
|
||
|
||
**:year** the 4 digit year<br/>
|
||
**:month** the 2 digit month<br/>
|
||
**:monthname** the name of the month<br/>
|
||
**:day** the 2 digit day<br/>
|
||
**:weekday** the 1 digit day of the week (Sunday = 0)<br/>
|
||
**:weekdayname** the name of the day of the week<br/>
|
||
**:yearday** the 1-3 digit day of the year<br/>
|
||
**:section** the content's section<br/>
|
||
**:title** the content's title<br/>
|
||
**:slug** the content's slug (or title if no slug)<br/>
|
||
**:filename** the content's filename (without extension)<br/>
|
||
|