【发布时间】:2015-04-08 15:53:02
【问题描述】:
我有一个网站,其中有很多归类到适当文件夹的降价文件。
Jekyll 会自动创建它们的 HTML 版本和 TOC(目录)。
在_config.yml 文件中,我可以重命名一些文件夹,重新排列它们(例如,如果我不希望它们按字母顺序排序)。
我浏览了他们的文档 (http://jekyllrb.com/docs/home/),但没有看到从 TOC 隐藏文件/文件夹的方法。我希望我错过了什么。
我想要从 TOC 中隐藏一些文件夹和文件,但让它们保持活动状态,以便具有正确 URL 的人仍然可以阅读文章。至于为什么 - 我不希望人们自己找到遗留的东西,但旧链接必须仍然有效,我必须保持信息在线。
因此,我不能在 markdown 文件本身的标题中使用 published: false 方法,因为这会使其脱机。
这是我的配置文件的示例:
"someFolderWithChildren":
title: "Name of my folder"
position: 10
"someFolderWithChildren/child-folder-I-want-hidden":
title: "hidden folder 1"
published: false
visible: false
noToc: true
hidden: true # these did not work (I admit to guessing in frustration a lot)
"someFolderWithChildren/another-folder-I-want-hidden":
title: "hidden folder 2"
position: 8
"someFolderWithChildren/folder-i-want-in-the-toc":
title: "some live folder"
position: 1
"someFolderWithChildren/folder-i-want-in-the-toc/child-folder-i-want live":
title: "yet another live foder"
position: 0
我真的希望有人能指出我正确的方向。
编辑:回答评论和回答 - 我不使用帖子,恐怕,我与其他类型的内容捆绑在一起。进一步挖掘表明 TOC 树实际上是一个自定义 JS 小部件,看来我需要研究现有插件生成其数据源的方式。感谢您的协助和时间。
【问题讨论】:
-
你能在你的问题中添加你的 TOC 循环吗?或者可能是您在 github 上的代码的链接?