Display 'Posts' header only if the site has posts (#144)

This commit is contained in:
Jimit Dholakia 2021-07-06 05:57:57 +05:30 committed by GitHub
parent e47c5ac128
commit 9bf8bee149
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 17 deletions

View File

@ -8,21 +8,24 @@ layout: default
<div class="index inner"> <div class="index inner">
<div>{{ content }}</div> <div>{{ content }}</div>
<div> {% if site.posts.size > 0 %}
<header class="section-title"> <div>
<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> <header class="section-title">
</header> <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>
<div class="entries-{{ page.entries_layout | default: 'list' }}"> </header>
{% if site.plugins contains 'jekyll-paginate' and page.paginate or site.gems contains 'jekyll-paginate' and page.paginate %} <div class="entries-{{ page.entries_layout | default: 'list' }}">
{% comment %} {% if site.plugins contains 'jekyll-paginate' and page.paginate or site.gems contains 'jekyll-paginate' and page.paginate %}
Add paginator.posts loop if jekyll-paginate plugin is enabled {% comment %}
and page.paginate == true Add paginator.posts loop if jekyll-paginate plugin is enabled
{% endcomment %} and page.paginate == true
{% include posts-paginated.html %} {% endcomment %}
{% else %} {% include posts-paginated.html %}
{% include posts-all.html %} {% else %}
{% endif %} {% include posts-all.html %}
{% endif %}
</div>
</div> </div>
</div> {% endif %}
</div> </div>
</main> </main>