From 1fdef72883296d1acafb1de8fd556ae5bfebb1e9 Mon Sep 17 00:00:00 2001
From: Greg Wilson <gvwilson@third-bit.com>
Date: Mon, 2 May 2016 07:08:34 -0400
Subject: [PATCH] Links to previous/next episodes

---
 _includes/episode_find_prev_next.html | 14 +++++++++++++
 _includes/episode_title.html          | 15 +-------------
 _includes/footer.html                 | 29 +++++++++++++++++++--------
 3 files changed, 36 insertions(+), 22 deletions(-)
 create mode 100644 _includes/episode_find_prev_next.html

diff --git a/_includes/episode_find_prev_next.html b/_includes/episode_find_prev_next.html
new file mode 100644
index 0000000..a8007e1
--- /dev/null
+++ b/_includes/episode_find_prev_next.html
@@ -0,0 +1,14 @@
+{% comment %}
+    Find previous and next episodes (if any).
+{% endcomment %}
+{% for episode in site.episodes  %}
+  {% if episode.url == page.url %}
+    {% unless forloop.first %}
+      {% assign prev_episode = prev %}
+    {% endunless %}
+    {% unless forloop.last %}
+      {% assign next_episode = site.episodes[forloop.index] %}
+    {% endunless %}
+  {% endif %}
+  {% assign prev = episode %}
+{% endfor %}
diff --git a/_includes/episode_title.html b/_includes/episode_title.html
index 297abde..8fa14be 100644
--- a/_includes/episode_title.html
+++ b/_includes/episode_title.html
@@ -1,17 +1,4 @@
-{% comment %}
-    Find previous and next episodes (if any).
-{% endcomment %}
-{% for episode in site.episodes  %}
-  {% if episode.url == page.url %}
-    {% unless forloop.first %}
-      {% assign prev_episode = prev %}
-    {% endunless %}
-    {% unless forloop.last %}
-      {% assign next_episode = site.episodes[forloop.index] %}
-    {% endunless %}
-  {% endif %}
-  {% assign prev = episode %}
-{% endfor %}
+{% include episode_find_prev_next.html %}
 <div class="row">
   <div class="col-md-1">
     <h3>{% if prev_episode %}<a href="{{ site.root }}{{ prev_episode.url }}"><span class="glyphicon glyphicon-menu-left"></span></a>{% endif %}</h3>
diff --git a/_includes/footer.html b/_includes/footer.html
index 97d12cb..5e0f5ed 100644
--- a/_includes/footer.html
+++ b/_includes/footer.html
@@ -1,12 +1,25 @@
+{% comment %}
+  Generic footer: prev_episode and next_episode will only be set if this is an episode,
+  so previous/next link arrows will not appear for other kinds of pages.
+{% endcomment %}
+{% include episode_find_prev_next.html %}
 <hr/>
 <footer class="row">
-  <div class="col-md-12 footertext">
-    Copyright &copy; 2016 Software Carpentry Foundation
-    /
-    <a href="{{ site.repo }}">Source</a>
-    /
-    <a href="{{ site.root }}/license/">License</a>
-    /
-    <a href="mailto:{{site.email}}">Contact</a>
+  <div class="col-md-1">
+    <h4>{% if prev_episode %}<a href="{{ site.root }}{{ prev_episode.url }}"><span class="glyphicon glyphicon-menu-left"></span></a>{% endif %}</h4>
+  </div>
+  <div class="col-md-10 footertext">
+    <h4>
+      Copyright &copy; 2016 Software Carpentry Foundation
+      /
+      <a href="{{ site.repo }}">Source</a>
+      /
+      <a href="{{ site.root }}/license/">License</a>
+      /
+      <a href="mailto:{{site.email}}">Contact</a>
+    </h4>
+  </div>
+  <div class="col-md-1">
+    <h4>{% if next_episode %}<a href="{{ site.root }}{{ next_episode.url }}"><span class="glyphicon glyphicon-menu-right"></span></a>{% endif %}</h4>
   </div>
 </footer>
-- 
GitLab