From 9bf8bee149d0b72ae4418dfcd785c658a9a5ada2 Mon Sep 17 00:00:00 2001 From: Jimit Dholakia Date: Tue, 6 Jul 2021 05:57:57 +0530 Subject: [PATCH] Display 'Posts' header only if the site has posts (#144) --- _layouts/home.html | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/_layouts/home.html b/_layouts/home.html index e40c4bf..e6e2577 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -7,22 +7,25 @@ layout: default
{{ content }}
- -
-
-

{{ 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 %}

-
-
- {% if site.plugins contains 'jekyll-paginate' and page.paginate or site.gems contains 'jekyll-paginate' and page.paginate %} - {% comment %} - Add paginator.posts loop if jekyll-paginate plugin is enabled - and page.paginate == true - {% endcomment %} - {% include posts-paginated.html %} - {% else %} - {% include posts-all.html %} - {% endif %} -
-
+ + {% if site.posts.size > 0 %} +
+
+

{{ 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 %}

+
+
+ {% if site.plugins contains 'jekyll-paginate' and page.paginate or site.gems contains 'jekyll-paginate' and page.paginate %} + {% comment %} + Add paginator.posts loop if jekyll-paginate plugin is enabled + and page.paginate == true + {% endcomment %} + {% include posts-paginated.html %} + {% else %} + {% include posts-all.html %} + {% endif %} +
+
+ {% endif %} +