Switch to relative: use page.root in most templates
[rnaseq-cwl-training.git] / _includes / episode_title.html
index 767f38f226cf06cc8af6e07a78fec72d99cee9a5..7ea24a26c3a06ec56f1dc32d4075589f353bc71a 100644 (file)
@@ -1,24 +1,45 @@
-{% 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.root }}{{ prev_episode.url }}"><span class="glyphicon glyphicon-menu-left"></span></a>
+      <a href="{{ site.github.url }}{{ prev_episode.url }}"><span class="glyphicon glyphicon-menu-left"></span></a>
+      {% elsif site.github.url %}
+      <a href="{{ site.github.url }}"><span class="glyphicon glyphicon-menu-up"></span></a>
       {% else %}
-      <a href="{{ site.root }}"><span class="glyphicon glyphicon-menu-up"></span></a>
+      <a href="/"><span class="glyphicon glyphicon-menu-up"></span></a>
       {% endif %}
     </h3>
   </div>
   <div class="col-md-10">
-    <h3 class="maintitle"><a href="{{ site.root }}/">{{ site.title }}</a></h3>
+    <h3 class="maintitle"><a href="{{ site.github.url }}/">{{ site.title }}</a></h3>
     <h1 class="maintitle">{{ page.title }}</h1>
   </div>
   <div class="col-md-1">
     <h3>
       {% if next_episode %}
-      <a href="{{ site.root }}{{ next_episode.url }}"><span class="glyphicon glyphicon-menu-right"></span></a>
+      <a href="{{ site.github.url }}{{ next_episode.url }}"><span class="glyphicon glyphicon-menu-right"></span></a>
+      {% elsif site.github.url %}
+      <a href="{{ site.github.url }}"><span class="glyphicon glyphicon-menu-up"></span></a>
       {% else %}
-      <a href="{{ site.root }}"><span class="glyphicon glyphicon-menu-up"></span></a>
+      <a href="/"><span class="glyphicon glyphicon-menu-up"></span></a>
       {% endif %}
     </h3>
   </div>