<!– Use if you want to show previous and next for all posts. –> {% assign user_url = site.url | append: site.baseurl %} {% assign full_base_url = user_url | default: site.github.url %} {% if page.previous.url %}

<div class="nextPrevDiv">
  <a href="{{ page.previous.url | prepend: full_base_url }}">
    <span class="nextPrev">Previous</span>
    <p>{{ page.previous.title }}</p>
    <p class="preview">{{ page.previous.content | strip_html | truncatewords:20 }}</p>
  </a>
</div>
{% endif %}
{% if page.next.url %}
<div class="nextPrevDiv">
  <a href="{{ page.next.url | prepend: full_base_url }}">
    <span class="nextPrev">Next</span>
    <p>{{ page.next.title }}</p>
    <p class="preview">{{ page.next.content | strip_html | truncatewords:20 }}</p>
  </a>
</div>

{% endif %}