diff --git a/_includes/episode_find_prev_next.html b/_includes/episode_find_prev_next.html new file mode 100644 index 0000000000000000000000000000000000000000..a8007e1d99d8f0c621577d8c0209eb0fbb606939 --- /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 297abde7de04000020ab343da217b27bea354609..8fa14be3a1811f6746bee5ce07bc8645e40cc8ac 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 97d12cbe4d650111d45aa057e8e5e98ea1e6d68f..5e0f5ed0ae6b8047d93d0cf2b8a03c68cfe692fd 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 © 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 © 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>