xiangming / landscape-plus

针对中国大陆地区对hexo官方主题landscape进行优化。
http://xiangming.github.io/landscape-plus/
MIT License
508 stars 107 forks source link

建议集成 生成目录 功能 #16

Open zhiweihuang opened 10 years ago

zhiweihuang commented 10 years ago

Just like this:

qq 20140822160812

xiangming commented 10 years ago

@zhiweihuang 你发的截图是哪款主题的?发个链接我参考。

zhiweihuang commented 10 years ago

Pacman http://yangjian.me/pacman/hello/introducing-pacman-theme/

xiangming commented 10 years ago

@zhiweihuang 这个功能没有太多人需要,你可以自己参考pacman修改一下。

marvin-zhao commented 10 years ago
        <% if(post.toc !== false && toc(post.content)){ %>
          <div id="toc" class="toc-article">
            <%- toc(post.content)%>
          </div>
        <% } %>

这个我自己加了,是hexo自带的toc功能,自己改下css就好

zhiweihuang commented 10 years ago

具体要怎么修改呢?新手表示亚历山大……

2014-08-30 22:59 GMT+08:00 Yangxufeng.Zhao notifications@github.com:

    <% if(post.toc !== false && toc(post.content)){ %>
      <div id="toc" class="toc-article">
        <%- toc(post.content)%>
      </div>
    <% } %>

这个我自己加了,是hexo自带的toc功能,自己改下css就好

— Reply to this email directly or view it on GitHub https://github.com/xiangming/landscape-plus/issues/16#issuecomment-53960682 .

marvin-zhao commented 10 years ago

layout/_partial/article.ejs 21行,如果没有改动过的话

      <% } else { %>
        <%- post.content %>
      <% } %>

改成

      <% } else { %>
        <% if(post.toc !== false && toc(post.content)){ %>
          <div id="toc" class="toc-article">
            <%- toc(post.content)%>
          </div>
        <% } %>
        <%- post.content %>
      <% } %>

然后记得定义toc-article样式,名字可以你自己随意改

xiangming commented 10 years ago

@joysboy 好评!

zhiweihuang commented 10 years ago

@joysboy 非常感谢你的解答。我按照你的方法修改了article.ejs,也在css使用了你提供的文件定义了toc,可是生成后显示效果却很奇怪,目录不是以区块形式居右显示的,具体参见下图,还望解答一二。

image

marvin-zhao commented 10 years ago

你css里没有定义float right

nshen commented 9 years ago

表示我也想要这功能

nshen commented 9 years ago

有人搞定了吗,求完整教程啊。

alvminvm commented 9 years ago

@nshen @zhiweihuang 可以看下我写的"只需三步,添加文章目录模块 ",因为之前对主题修改的地方太多了,没办法请求合并到源库中。

jerry011235 commented 9 years ago

@nshen @zhiweihuang 我写了一篇教程,希望能帮到助你。 为Hexo博文添加文章目录

x1ah commented 8 years ago

这个功能确实可以内嵌在里面,然后自己选择开不开,这样也就不用自己折腾了。