Jekyll基于布局的永久链接 [英] Jekyll permalinks based on layout
问题描述
我正在第一个Jekyll网站上工作,希望在那里有很多不同的东西,例如博客文章,链接列表,相册等等,因此已经准备了很多布局以适合每个人.
所以我想知道是否可以让Jekyll根据布局设置永久链接,以便帖子的永久链接自动设置为/layout_name/yy/mm/post_name
./p>
我一直在研究 Jekyll的永久链接文档和各种Jekyll教程,但无济于事,现在我想知道是否有可能实现此自动化.
任何帮助将不胜感激,谢谢!
遵循每种类型的页面/帖子都可以位于特定文件夹(例如:相册的/相册)中的原理,默认配置.
这可以帮助您为 _config.yml
中的文件夹设置默认的永久链接
:
默认值:--范围:路径:相册"类型:帖子"值:永久链接:我/相册/"
I'm working on my first Jekyll website, and I'm expecting to have a bunch of different things there such as blog posts, a linked list, photo albums, and so on, and have thus prepared a whole bunch of layouts to suit each of them.
So I was wondering if there was a way I could get Jekyll to set permalinks based on the layout, so that posts have their permalink automatically set to /layout_name/yy/mm/post_name
.
I've been digging around Jekyll's permalink documentation and various Jekyll tutorials, but to no avail, and now I'm wondering if it's even possible to automate this.
Any help will be greatly appreciated, thanks!
Following the principle that each type of page/post can be in a specific folder (eg: /albums for you photo albums), you can have a look at default configuration.
This can help you to set default permalink
for a folder in _config.yml
:
defaults:
-
scope:
path: "albums"
type: "posts"
values:
permalink: "my/albums/"
这篇关于Jekyll基于布局的永久链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!