Skip to content

Commit 9bf8bee

Browse files
authored
Display 'Posts' header only if the site has posts (#144)
1 parent e47c5ac commit 9bf8bee

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

_layouts/home.html

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,25 @@
77
<main id="main" class="page-content" aria-label="Content">
88
<div class="index inner">
99
<div>{{ content }}</div>
10-
11-
<div>
12-
<header class="section-title">
13-
<h2>{{ site.data.theme.t.posts | default: 'Posts' }}{% if paginator.page > 1 %}{{ site.data.theme.t.page | default: 'Page' | prepend: ' - ' | append: ' ' }}{{ paginator.page }} {{ site.data.theme.t.of | default: 'of' }} {{ paginator.total_pages }}{% endif %}</h2>
14-
</header>
15-
<div class="entries-{{ page.entries_layout | default: 'list' }}">
16-
{% if site.plugins contains 'jekyll-paginate' and page.paginate or site.gems contains 'jekyll-paginate' and page.paginate %}
17-
{% comment %}
18-
Add paginator.posts loop if jekyll-paginate plugin is enabled
19-
and page.paginate == true
20-
{% endcomment %}
21-
{% include posts-paginated.html %}
22-
{% else %}
23-
{% include posts-all.html %}
24-
{% endif %}
25-
</div>
26-
</div>
10+
11+
{% if site.posts.size > 0 %}
12+
<div>
13+
<header class="section-title">
14+
<h2>{{ site.data.theme.t.posts | default: 'Posts' }}{% if paginator.page > 1 %}{{ site.data.theme.t.page | default: 'Page' | prepend: ' - ' | append: ' ' }}{{ paginator.page }} {{ site.data.theme.t.of | default: 'of' }} {{ paginator.total_pages }}{% endif %}</h2>
15+
</header>
16+
<div class="entries-{{ page.entries_layout | default: 'list' }}">
17+
{% if site.plugins contains 'jekyll-paginate' and page.paginate or site.gems contains 'jekyll-paginate' and page.paginate %}
18+
{% comment %}
19+
Add paginator.posts loop if jekyll-paginate plugin is enabled
20+
and page.paginate == true
21+
{% endcomment %}
22+
{% include posts-paginated.html %}
23+
{% else %}
24+
{% include posts-all.html %}
25+
{% endif %}
26+
</div>
27+
</div>
28+
{% endif %}
29+
2730
</div>
2831
</main>

0 commit comments

Comments
 (0)