Skip to content

Commit 4888a20

Browse files
committed
Only show tag cloud and related posts if there are actually things to show
1 parent 781d759 commit 4888a20

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

_includes/tagcloud.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

22
{% if site.plugins contains "jekyll/tagging" %}
3-
<h2>All tags</h2>
4-
<div class="tag-cloud">
5-
{{ site | tag_cloud }}
6-
</div>
3+
{% assign size = site | tag_cloud | size %}
4+
{% if size != 0 %}
5+
<h2>All tags</h2>
6+
<div class="tag-cloud">{{ site | tag_cloud }}</div>
7+
{% endif %}
78
{% endif %}

_layouts/post.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ <h1 class="post-title">{{ page.title }}</h1>
2424
</div>
2525
{% endif %}
2626

27+
{% assign size = site.related_posts | size %}
28+
{% if size != 0 %}
2729
<div class="related">
2830
<h2>Related Posts</h2>
2931
<ul class="related-posts">
@@ -38,4 +40,5 @@ <h3>
3840
{% endfor %}
3941
</ul>
4042
</div>
43+
{% endif %}
4144
{% include tagcloud.html %}

0 commit comments

Comments
 (0)