jekyll - Jekyll 中的子集合或子类别

标签 jekyll

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/

相关文章:

css - 为什么 bourbon mixins 在我的 jekyll 网站上不起作用?

html - haml 文件中的 yaml 前端内容

Jekyll - 获取多个类别中的所有帖子

jekyll - 如何为 octopress 博客安装 jekyll 插件?

ruby-on-rails - jekyll 与 ruby​​ 有什么关系?

jekyll - 如何在 Liquid 中对集合进行分组?

github - 如何配置 GitHub 以使用不受支持的 Jekyll 站点插件?

html - jekyll 页面在本地工作但在线时不工作

ruby - Jekyll 私有(private)部署?

Github 页面构建错误 : The jekyll-theme-hydejack theme could not be found