aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2014-06-17 14:58:29 +0100
committerLouise Crow <louise.crow@gmail.com>2014-06-17 14:58:29 +0100
commit034eaeac731426a9b0f20ca449781e93e97c3940 (patch)
tree50912cac3db120ef1c13ab3522840508497e5c9d
parenta0733ac3158bc7a8373fe07432b5c3d93260fd8e (diff)
Extend breadcrumbs
They cover the entire path, except on the blog where we don't generate period pages.
-rw-r--r--_layouts/page.html17
1 files changed, 10 insertions, 7 deletions
diff --git a/_layouts/page.html b/_layouts/page.html
index b753f54b7..23be68e6e 100644
--- a/_layouts/page.html
+++ b/_layouts/page.html
@@ -4,7 +4,7 @@ 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 parts = url_parts | split: ' ' %}
{% assign previous="" %}
<ul class="breadcrumb">
{% if num_parts == "-1" %}
@@ -12,12 +12,15 @@ layout: default
<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 %}
+ {% if page.slug == null %}
+ {% for part in parts %}
+ {% capture previous %}{{ previous }}/{{ part }}{% endcapture %}
+ <li><a href="{{ previous }}/">{{ part | capitalize | replace:'_'," " }}</a></li>
+ {% capture url_parts %}{{ url_parts | remove_first:part }}{% endcapture %}
+ {% endfor %}
+ {% else %}
+ <li><a href="/blog">Blog</a></li>
+ {% endif %}
{% endif %}
</ul>