Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions _layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,25 @@
<main id="main" class="page-content" aria-label="Content">
<div class="index inner">
<div>{{ content }}</div>

<div>
<header class="section-title">
<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>
<div class="entries-{{ page.entries_layout | default: 'list' }}">
{% 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 %}
</div>
</div>

{% if site.posts.size > 0 %}
<div>
<header class="section-title">
<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>
<div class="entries-{{ page.entries_layout | default: 'list' }}">
{% 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 %}
</div>
</div>
{% endif %}

</div>
</main>