Modify Permalink Structure of Jekyll Theme Minimal Mistakes
My blog website is based on a Jekyll theme minimal-mistake
1. Under default settings, the permalink of a blog page is composite of categories
key and the file name of corresponding .md
file. For example, if I write a .md
file named 2023-10-21-This-is-a-Test-File-(md-file-Name).md
, and whose content is:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
---
layout: single
title: This is a Test File
date: 2023-10-21 16:42:58 +0800
categories:
- Test Category 1
- Test Category 2
tag:
- Test Tag 1
- Test Tag 2
toc: false
---
This is content of test file.
After I post it, the corresponding website is like:
As can be seen, the permalink is determined by categories
key in YAML language area and the text after date in .md
file name. And the website breadcrumbs are determined by categories
and title
key in YAML area.
However, during the process of managing website contents, I find this permalink structure is kind of fragile, cause sometimes I would modify the categories of the blog and the .md
file name, which makes the previous permalink is not available any more. So, I want to find a more unique permalink structure.
Actually, the permalink structure setting could be found in _config.yml
file:
We could change it to:
1
permalink: /:year-:month-:day/:hour-:minute-:second:output_ext
N.B., References23 give detailed information about how to specify this setting.
making date and time stamp construct permalink:
However, it shows that the Jekyll will resolve the content between the first and the second slash in permalink as a category, which is out of expectation.
When I click 2023 10 21
in breadcrumbs, the website will jump to categories.html
, but we could find that it doesn’t create a real category:
On another hand, if we set permalink structure like:
1
permalink: /:year-:month-:day-:hour-:minute-:second:output_ext
that is don’t use slash to separate date and time, the permalink and breadcrumbs will show like this:
At this case, the breadcrumbs look useless.
I tend to use slash to make a separation, so I decide to delete breadcrumbs: open .\layouts\single.html
and comment the following code:
Added on Oct. 27, 2023: Actually, the breadcrumbs function could be closed by specifying breadcrumbs
key in _config.yml
to false
, instead of commenting above code, the details could be found in4.
The final effect is:
not bad anyway ~
References