Cleaning up prev/next logic
authorGreg Wilson <gvwilson@third-bit.com>
Thu, 14 Jul 2016 17:40:18 +0000 (13:40 -0400)
committerGreg Wilson <gvwilson@third-bit.com>
Thu, 14 Jul 2016 17:40:18 +0000 (13:40 -0400)
_includes/episode_find_prev_next.html [deleted file]
_includes/episode_title.html

diff --git a/_includes/episode_find_prev_next.html b/_includes/episode_find_prev_next.html
deleted file mode 100644 (file)
index a8007e1..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-{% 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 %}
index 5e2e4ec029e361b8faf600c4b6164896921d29c0..7ea24a26c3a06ec56f1dc32d4075589f353bc71a 100644 (file)
@@ -1,11 +1,30 @@
-{% include episode_find_prev_next.html %}
+{% 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 %}
+
+{% comment %}
+  Display title and prev/next links.
+{% endcomment %}
 <div class="row">
   <div class="col-md-1">
     <h3>
       {% if prev_episode %}
       <a href="{{ site.github.url }}{{ prev_episode.url }}"><span class="glyphicon glyphicon-menu-left"></span></a>
-      {% else %}
+      {% elsif site.github.url %}
       <a href="{{ site.github.url }}"><span class="glyphicon glyphicon-menu-up"></span></a>
+      {% else %}
+      <a href="/"><span class="glyphicon glyphicon-menu-up"></span></a>
       {% endif %}
     </h3>
   </div>
     <h3>
       {% if next_episode %}
       <a href="{{ site.github.url }}{{ next_episode.url }}"><span class="glyphicon glyphicon-menu-right"></span></a>
-      {% else %}
+      {% elsif site.github.url %}
       <a href="{{ site.github.url }}"><span class="glyphicon glyphicon-menu-up"></span></a>
+      {% else %}
+      <a href="/"><span class="glyphicon glyphicon-menu-up"></span></a>
       {% endif %}
     </h3>
   </div>