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.
The simplest way to change a permalink is using the front matter
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 should set:
--- permalink: /about ---
Setting a permalink using the front matter
permalink 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
: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.
Here’s the full list of placeholders available:
|year||Year from the page attribute |
|month||Month from the page attribute |
|i_month||Month from the page attribute |
|day||Day from the page attribute |
|i_day||Day from the page attribute |
|slug||The filename of the page, without extension|