aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Wright <martin@mynameismartin.com>2014-06-12 12:34:03 +0100
committerLouise Crow <louise.crow@gmail.com>2014-06-17 12:58:33 +0100
commit598dcb1f3cd7f4d3a0d6ab20599489c4900d33fe (patch)
treea29c5c90b4270669e6904764796fc63cbdd5953d
parentc45c1276274bf149a0cc1f8b8b3a100665e0b7ea (diff)
added breadcrumb
-rw-r--r--_layouts/page.html18
1 files changed, 18 insertions, 0 deletions
diff --git a/_layouts/page.html b/_layouts/page.html
index 9c12751cc..2c1869382 100644
--- a/_layouts/page.html
+++ b/_layouts/page.html
@@ -3,6 +3,24 @@ layout: default
---
<div class="page-wrapper">
<div class="page">
+{% capture url_parts %} {{ page.url | remove: "/index.html" | replace:'/'," " }}{% endcapture %}
+ {% capture num_parts %}{{ url_parts | number_of_words | minus: 1 }}{% endcapture %}
+ {% assign previous="" %}
+ <ul class="breadcrumb">
+ {% if num_parts == "-1" %}
+ {% elsif num_parts == "0" %}
+ <li><a href="/">Home</a></li>
+ {% else %}
+ <li><a href="/">Home</a></li>
+ {% for unused in page.content limit:num_parts %}
+ {% capture first_word %}{{ url_parts | truncatewords:1 | remove:"..."}}{% endcapture %}
+ {% capture previous %}{{ previous }}/{{ first_word }}{% endcapture %}
+ <li><a href="{{ previous }}/">{{ first_word | capitalize }}</a></li>
+ {% capture url_parts %}{{ url_parts | remove_first:first_word }}{% endcapture %}
+ {% endfor %}
+ {% endif %}
+ </ul>
+
<div class="main-content-column">
<main role="main" class="main-content">
{{ content }}