add chapter sorting mechanism
This commit is contained in:
parent
a1a8d694e2
commit
592da6cad6
7 changed files with 34 additions and 4 deletions
|
|
@ -17,21 +17,31 @@
|
|||
{% else %}
|
||||
{% set pages = section.pages %}
|
||||
{% endif %}
|
||||
{% if section.extra.use_chapter_sort %}
|
||||
{% set pages = pages | sort(attribute="extra.chapter") %}
|
||||
{% for page in pages %}
|
||||
<li>
|
||||
<span class="chapter">{{ page.extra.chapter }}</span>
|
||||
<a href="{{ page.permalink }}">{{ page.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for page in pages %}
|
||||
<li>
|
||||
<time datetime="{{ page.date }}">{{ page.date | date(format="%Y-%m-%d") }}</time>
|
||||
<a href="{{ page.permalink }}">{{ page.title }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
||||
{% if paginator %}
|
||||
<nav class="pagination">
|
||||
{% if paginator.previous %}
|
||||
<a href="{{ paginator.previous }}">← Newer</a>
|
||||
<a href="{{ paginator.previous }}">← {% if section.extra.use_chapter_sort %}Previous{% else %}Newer{% endif %}</a>
|
||||
{% endif %}
|
||||
{% if paginator.next %}
|
||||
<a href="{{ paginator.next }}">Older →</a>
|
||||
<a href="{{ paginator.next }}">{% if section.extra.use_chapter_sort %}Next{% else %}Older{% endif %} →</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue