Skip to content

Commit

Permalink
Merge pull request #451 from restran/master
Browse files Browse the repository at this point in the history
在 post 中也可以添加一个配置项 toc_number,这样就可以单独为 post 设置了。
  • Loading branch information
iissnan committed Oct 26, 2015
2 parents 858872e + 4a94147 commit e7fec32
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion layout/_macro/sidebar.swig
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@
<section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
<div class="post-toc-indicator-top post-toc-indicator"></div>
<div class="post-toc">
{% set toc = toc(page.content, { "class": "nav", list_number: theme.toc.number }) %}
{% if page.toc_number === undefine %}
{% set toc = toc(page.content, { "class": "nav", list_number: theme.toc.number }) %}
{% else %}
{% set toc = toc(page.content, {"class": "nav", list_number: page.toc_number}) %}
{% endif %}
{% if toc.length <= 1 %}
<p class="post-toc-empty">{{ __('post.toc_empty') }}</p>
{% else %}
Expand Down

0 comments on commit e7fec32

Please sign in to comment.