Skip to content

Commit

Permalink
Fix: hide archives in sidebar if equal to 0.
Browse files Browse the repository at this point in the history
If in main config of hexo `archive_dir` is set to '/' then archives will not generate by hexo-generator-archive: https://github.com/hexojs/hexo-generator-archive/blob/master/lib/generator.js#L19

Idea take from #639.
  • Loading branch information
ivan-nginx committed Dec 14, 2016
1 parent 56347e4 commit ed64a99
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions layout/_macro/sidebar.swig
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@
<p class="site-description motion-element" itemprop="description">{{ theme.description }}</p>
</div>
<nav class="site-state motion-element">
<div class="site-state-item site-state-posts">
<a href="{{ url_for(theme.menu.archives) }}">
<span class="site-state-item-count">{{ site.posts.length }}</span>
<span class="site-state-item-name">{{ __('state.posts') }}</span>
</a>
</div>

{% if config.archive_dir != '/' %}
<div class="site-state-item site-state-posts">
<a href="{{ url_for(theme.menu.archives) }}">
<span class="site-state-item-count">{{ site.posts.length }}</span>
<span class="site-state-item-name">{{ __('state.posts') }}</span>
</a>
</div>
{% endif %}

{% if site.categories.length > 0 %}
<div class="site-state-item site-state-categories">
Expand Down

0 comments on commit ed64a99

Please sign in to comment.