From cf155463b4a665b31b11851f705e30a9588a23a6 Mon Sep 17 00:00:00 2001
From: Greg Wilson <gvwilson@third-bit.com>
Date: Mon, 5 Sep 2016 13:51:02 -0400
Subject: [PATCH] Navigation links in footer

---
 _includes/episode_navbar.html  | 45 ++++++++++++++++++++++++++++++++++
 _includes/lesson_footer.html   |  1 -
 _includes/workshop_footer.html |  1 -
 _layouts/break.html            |  3 ++-
 _layouts/episode.html          |  3 ++-
 5 files changed, 49 insertions(+), 4 deletions(-)
 create mode 100644 _includes/episode_navbar.html

diff --git a/_includes/episode_navbar.html b/_includes/episode_navbar.html
new file mode 100644
index 0000000..082047f
--- /dev/null
+++ b/_includes/episode_navbar.html
@@ -0,0 +1,45 @@
+{% comment %}
+  Find previous and next episodes (if any).
+  Including file must pass episode_navbar_title=true or ...=false to display episode title.
+{% 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 %}
+
+{% comment %}
+  Display title and prev/next links.
+{% endcomment %}
+<div class="row">
+  <div class="col-md-1">
+    <h3>
+      {% if prev_episode %}
+      <a href="{{ page.root }}{{ prev_episode.url }}"><span class="glyphicon glyphicon-menu-left"></span></a>
+      {% else %}
+      <a href="{{ page.root }}/"><span class="glyphicon glyphicon-menu-up"></span></a>
+      {% endif %}
+    </h3>
+  </div>
+  <div class="col-md-10">
+    {% if include.episode_navbar_title %}
+    <h3 class="maintitle"><a href="{{ page.root }}/">{{ site.title }}</a></h3>
+    <h1 class="maintitle">{{ page.title }}</h1>
+    {% endif %}
+  </div>
+  <div class="col-md-1">
+    <h3>
+      {% if next_episode %}
+      <a href="{{ page.root }}{{ next_episode.url }}"><span class="glyphicon glyphicon-menu-right"></span></a>
+      {% else %}
+      <a href="{{ page.root }}/"><span class="glyphicon glyphicon-menu-up"></span></a>
+      {% endif %}
+    </h3>
+  </div>
+</div>
diff --git a/_includes/lesson_footer.html b/_includes/lesson_footer.html
index 58d08fa..beef2cb 100644
--- a/_includes/lesson_footer.html
+++ b/_includes/lesson_footer.html
@@ -1,4 +1,3 @@
-<hr/>
 <footer>
   <div class="row">
     <div class="col-md-6" align="left">
diff --git a/_includes/workshop_footer.html b/_includes/workshop_footer.html
index 1b94957..31e5f37 100644
--- a/_includes/workshop_footer.html
+++ b/_includes/workshop_footer.html
@@ -1,4 +1,3 @@
-<hr/>
 <footer>
   <div class="row">
     <div class="col-md-6" align="left">
diff --git a/_layouts/break.html b/_layouts/break.html
index 91e4532..6e2a6a0 100644
--- a/_layouts/break.html
+++ b/_layouts/break.html
@@ -1,6 +1,7 @@
 ---
 layout: base
 ---
-{% include episode_title.html %}
+{% include episode_navbar.html episode_navbar_title=true %}
 {% include episode_break.html %}
 {{content}}
+{% include episode_navbar.html episode_navbar_title=false %}
diff --git a/_layouts/episode.html b/_layouts/episode.html
index 3776397..d774a68 100644
--- a/_layouts/episode.html
+++ b/_layouts/episode.html
@@ -1,7 +1,8 @@
 ---
 layout: base
 ---
-{% include episode_title.html %}
+{% include episode_navbar.html episode_navbar_title=true %}
 {% include episode_overview.html %}
 {{content}}
 {% include episode_keypoints.html %}
+{% include episode_navbar.html episode_navbar_title=false %}
-- 
GitLab