相关疑难解决方法(0)

如何为Jekyll博客帖子创建目录?

如果我在Jekyll中有一个带标题的页面/帖子,是否可以自动生成目录/大纲以进行导航?类似于维基百科文章的最重要的东西.

markdown jekyll

30
推荐指数
2
解决办法
7224
查看次数

Jekyll自动目录

我已经建立了一个基于Apache Buildr网站的Jekyll代码的网站.Buildr网站根据textile格式文件中的标题自动为每个页面生成目录.

例如,您使用纺织品标记页面,就像这样标题..

h2(#why).  Why are we doing this?

BLah blah balh etc ..


h2(#something). Some other header

BLah blah balh etc ..
Run Code Online (Sandbox Code Playgroud)

然后在默认的HTML中,你有一些代码将内容传递给被调用的东西toc然后你把内容放到后面.例如 ...

<div id='content'>
 <h1 id='{{ page.title | downcase | replace(' ', '_') }}'>{{ page.title }}</h1>
  {{ content | toc }}
  {{ content }}
</div>
Run Code Online (Sandbox Code Playgroud)

在Apache站点上,他们获得了所需的结果(显示toc后跟内容).但是,在我的网站上,内容呈现两次.没有生成目录.

此外,如果我直接从github克隆Apache Buildr项目并jekyll --server在该doc项目的文件夹中运行,那么也不会生成目录.

我错过了什么?

html ruby tableofcontents jekyll web

5
推荐指数
1
解决办法
3690
查看次数

标签 统计

jekyll ×2

html ×1

markdown ×1

ruby ×1

tableofcontents ×1

web ×1