我如何在 Jekyll 中不仅从帖子中而且从页面中删除 .html 扩展名?
How do I remove the .html extension from not only posts, but pages as well in Jekyll?
在我的 Jekyll 配置文件中,我将永久链接设置为 permalink: /:year/:month/:day/:title/
,以便从 post 中删除 HTML 扩展名,但这仅适用于降价 posts,而不是页面。
如果我希望我的所有页面都删除 .html,例如我的 about.html 页面更改为 /about,我是否必须创建文件夹然后将 index.html,或者 Jekyll 可以为我做这件事吗?
_config.yml 中的此设置将起作用:
# applies pretty for all
permalink: pretty
# overrides permalink for posts
defaults:
-
scope:
path: ""
type: "posts"
values:
permalink: /:year/:month/:day/:title/
请注意,页面前端内容中的永久链接将覆盖配置中的永久链接。
检查 YAML 配置文件的此设置:
#for all pages
permalink: pretty
#for posts
defaults:
- scope:
path: ""
type: "posts"
values:
permalink: /blog/:title
在我的 Jekyll 配置文件中,我将永久链接设置为 permalink: /:year/:month/:day/:title/
,以便从 post 中删除 HTML 扩展名,但这仅适用于降价 posts,而不是页面。
如果我希望我的所有页面都删除 .html,例如我的 about.html 页面更改为 /about,我是否必须创建文件夹然后将 index.html,或者 Jekyll 可以为我做这件事吗?
_config.yml 中的此设置将起作用:
# applies pretty for all
permalink: pretty
# overrides permalink for posts
defaults:
-
scope:
path: ""
type: "posts"
values:
permalink: /:year/:month/:day/:title/
请注意,页面前端内容中的永久链接将覆盖配置中的永久链接。
检查 YAML 配置文件的此设置:
#for all pages
permalink: pretty
#for posts
defaults:
- scope:
path: ""
type: "posts"
values:
permalink: /blog/:title