Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 1.83 KB

permalinks.md

File metadata and controls

48 lines (34 loc) · 1.83 KB
title layout
Permalinks
docs

Permalinks are the output path for your pages and posts. They allow you to structure the directories of your source code different from the directories in your output.

By default we infer permalink from filename.

Page Attribute

The simplest way to change a permalink is using the page attribute permalink.

For example, you might have a Markdown page on your site located at ./pages/sub_folder/hello.md and you want the output url to be /about In the front matter of the page you would set:

---
permalink: /about
---

Global

Setting a permalink using the permalink attribute for every page on your site is no fun. Luckily, Saber lets you set the permalink structure globally in your config file.

To set a global permalink, you use the permalink variable in saber-config.yml. You can use placeholders to modify the output. For example:

# Default values:
permalinks:
  post: /:year/:month/:day/:slug.html
  page: /:slug.html

Note that placeholders like :year and :month are parsed from the page attribute createdAt which can be any valid date value like: 2015-02-31, it defaults to the creation time of your page.

Placeholders

Here’s the full list of placeholders available:

Variable Description
year Year from the page attribute date
month Month from the page attribute date
i_month Month from the page attribute date, without leading zero
day Day from the page attribute date
i_day Day from the page attribute date, without leading zero
slug The filename of the page, without extension