-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathcategory_index.html
50 lines (42 loc) · 1.59 KB
/
category_index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
layout: basic
---
{% if page.paginator %}
<!-- Pagination is active -->
{% assign paginator = page.paginator %}
{% if paginator.previous_page != nil or paginator.next_page != nil %}
<!-- Show page number if we have multiple pages -->
<h1>Category index page {{ paginator.page }} / {{ paginator.total_pages }} for “{{ page.title }}”</h1>
{% else %}
<!-- No page number if we only have a single page -->
<h1>Category index for “{{ page.title }}”</h1>
{% endif %}
<section>
<!-- Show post excerpts for the current page -->
{% for post in paginator.posts limit:paginator.per_page %}
<article>
<h3><a href="{{ post.url }}">{{ post.title }}</a></h3>
<h5>{{ post.date }}</h5>
<p>{{ post.excerpt }}</p>
</article>
{% endfor %}
</section>
<!-- Show navigation next/previous page links if applicable -->
<nav><p>
{% if paginator.previous_page %}<a href="{{ paginator.previous_page_path }}"><span aria-hidden="true">←</span> Newer</a>{% endif %}
{% if paginator.next_page %}<a href="{{ paginator.next_page_path }}">Older <span aria-hidden="true">→</span></a>{% endif %}
</p></nav>
{% else %}
<!-- Pagination is not active -->
<h1>Category index for “{{ page.title }}”</h1>
<section>
<!-- Show excerpts for all posts in this category -->
{% for post in page.posts %}
<article>
<h3><a href="{{ post.url }}">{{ post.title }}</a></h3>
<h5>{{ post.date }}</h5>
<p>{{ post.excerpt }}</p>
</article>
{% endfor %}
</section>
{% endif %}