You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mediarepo/_includes/previous-next_docs.html

30 lines
1.2 KiB
HTML

<!-- Use if you want to show previous and next for posts within a category. -->
{% assign posts = site.docs | sort: "sort_index" %}
{% for post in posts %}
{% if post.sort_index < page.sort_index %}
{% assign prev_post = post %}
{% endif %}
{% if post.sort_index > page.sort_index %}
{% assign next_post = post %}
{% break %}
{% endif %}
{% endfor %}
{% assign user_url = site.url | append: site.baseurl %}
{% assign full_base_url = user_url | default: site.github.url %}
{% if prev_post and prev_post.draft == false %}
<div class="col-4 sm-width-full left mr-lg-4 mt-3">
<a class="no-underline border-top-thin py-1 block" href="{{ prev_post.url | prepend: full_base_url }}">
<span class="h5 bold text-accent">Previous</span>
<p class="bold h3 link-primary mb-1">{{ prev_post.title }}</p>
</a>
</div>
{% endif %}
{% if next_post and next_post.draft == false %}
<div class="col-4 sm-width-full left mt-3">
<a class="no-underline border-top-thin py-1 block" href="{{ next_post.url | prepend: full_base_url }}">
<span class="h5 bold text-accent">Next</span>
<p class="bold h3 link-primary mb-1">{{ next_post.title }}</p>
</a>
</div>
{% endif %}