permalink 中使用一個新增的變數 urlname。permalink_defaults 中設定 urlname 的預設值為 index。之後要自訂文章網址時,只需要在 Markdown 文件中的 Front-matter 內設定 urlname 就可以客製化文章網址了。
/_config.yml
permalink: post/:urlname/
permalink_defaults:
urlname: index
未來在要發布的文章 Front-matter 上增加剛剛設定的 urlname 並設定自訂網址即可自訂文章網址。
example_post.md
---
layout: post
urlname: 文章網址
title: 文章標題
---

以設定 example.com 網域為例:
/_config.yml
url: <https://example.com>
root: /
如果網站存放在子目錄中,例如
http://example.com/blog,請將 url 設為http://example.com/blog並把root設為/blog/。
前往網址供應商的設定頁面設定 DNS
以上有兩種類型設定分別是 A 記錄 和 CNAME 記錄,兩者重點都是在設定名稱和內容,不同的點在於:
名稱指向 IP 地址(內容)。