Time passes and Cmaketopia project goes on. Suddenly I realized that I needed to add navigation to the site. Jekyll has such but for posts but not for pages. I was googling for hours. But all solutions were too complicated. I had to do it myself. I wanted to implement a bidirectional list based on Jekyll markdown pages. I thought “Keep it simple stupid!” See how I did it. First I added two Custom Variables previous_page and next_page that I could access in Liquid.
---
layout: page
title: Cmake Philosophy
previous_page: PreviousPageNameURL
next_page: NextPageNameURL
---
# Cmake Philosophy
Second, on the page template I added two divisions at the bottom.
<div class="left align-right">
{% if page.previous_page %}
<a href="{{ page.previous_page }}">«Back</a>
{% else %}
<span class="prev disabled">«Back</span>
{% endif %}
</div>
<div class="right align-left">
{% if page.next_page %}
<a href="{{ page.next_page }}">Next »</a>
{% else %}
<span class="prev disabled">Next »</span>
{% endif %}
</div>
You can see an effect on Cmaketopia page.
Just a kiss.
Bye
C