Jekyll 中是否有内置方法用于形成类别和子类别,或者集合和子集合?
例如:
├───linux
│ ├───desktops
│ └───shell
└───windows
├───desktop
└───server
我目前正在使用“linux”和“windows”的集合,并且可以在每个集合中放置一个 index.html
页面以创建可浏览的结构,但是我想对帖子进行进一步分类并以编程方式在网站上显示“子类别”或“子集合”。
最佳答案
我也一直在努力满足这种需求......不走运😕。
但是,我想我找到了一种解决方法,可以帮助保持文件夹结构整洁。 集合、命名约定和永久链接的组合。
例如:
linux-main:
output: true
permalink: /linux/:title/
linux-desktop:
output: true
permalink: /linux/desktop/:title/
linux-shell:
output: true
permalink: /linux/shell/:title/
windows-main:
output: true
permalink: /windows/:title/
windows-desktop:
output: true
permalink: /windows/desktop/:title/
windows-shell:
output: true
permalink: /windows/shell/:title/
在项目结构中,它看起来像这样:
📦 Project
┣ 📂 linux-main
┃ ┣ 📝post1.md
┃ ┗ 📝post2.md
┣ 📂 linux-desktop
┃ ┣ 📝post1.md
┃ ┗ 📝post2.md
┣ 📂 linux-shell
┃ ┗ 📝post1.md
┣ 📂 windows-main
┣ 📂 windows-desktop
┗ 📂 windows-shell
_site 文件夹将是:
📦 Project
┣ 📂 linux
┃ ┣ 📝post1.html
┃ ┣ 📝post2.html
┣ ┣ 📂 desktop
┃ ┃ ┣ 📝post1.html
┃ ┃ ┗ 📝post2.html
┣ ┗ 📂 shell
┃ ┗ 📝post1.html
┗ 📂 windows
┣ 📂 desktop
┗ 📂 shell
关于jekyll - Jekyll 中的子集合或子类别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72553081/