Commit 0495b566 authored by Blaine Murphy's avatar Blaine Murphy
Browse files

Added breadcrumbs

parent 8586c44a
......@@ -48,6 +48,48 @@ layout: base
<article class="document">
<header class="document-header {% if page.no_header %}document-header-hidden{% endif %}">
<nav class="document-breadcrumbs">
{%- if page.path != "index.md" -%}
<span class="document-breadcrumb"><a href="{{ site.baseurl }}/">Home</a></span>
{%- endif -%}
{%- comment -%}collection pages{%- endcomment -%}
{%- if page.collection -%}
{%- assign _collection_path = page.collection | append: "/index.md" -%}
{%- assign _collection_page = site.pages | where: "path", _collection_path | first -%}
<span class="document-breadcrumb"><a href="{{ site.baseurl }}{{ _collection_page.url }}">{{ _collection_page.title | escape }}</a></span>
{%- assign _categories = page.categories | join: "" -%}
{%- if _categories != "" -%}
{%- assign _parent_path = "_" | append: page.collection | append: "/" | append: page.categories[0] | append: ".md" -%}
{%- assign _parent_page = site.documents | where: "path", _parent_path | first -%}
<span class="document-breadcrumb"><a href="{{ site.baseurl }}{{ _parent_page.url }}">{{ _parent_page.title | escape }}</a></span>
{%- endif -%}
{%- comment -%}static pages{%- endcomment -%}
{%- else -%}
{%- assign _path_segments = page.path | split: "/" -%}
{%- assign _dir_path = "" -%}
{%- for _segment in _path_segments -%}
{%- if forloop.last -%}
{%- break -%}
{%- endif -%}
{%- assign _dir_path = _dir_path | append: _segment | append: "/" -%}
{%- assign _index_path = _dir_path | append: "index.md" -%}
{%- if _index_path != page.path -%}
{%- assign _index_page = site.pages | where: "path", _index_path | first -%}
{%- if _index_page -%}
<span class="document-breadcrumb"><a href="{{ site.baseurl }}{{ _index_page.url }}">{{ _index_page.title | escape }}</a></span>
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
<span class="document-breadcrumb-last">{{ page.title | escape }}</span>
</nav>
{%- include heading.html level=1 text=page.title flair=page.flair -%}
{%- if page.date -%}
<div class="document-date">Published {% include date.html date=page.date %}</div>
......@@ -63,14 +105,14 @@ layout: base
{%- if _prev_document -%}
<a class="document-prev-link" href="{{ site.baseurl }}{{ _prev_document.url }}">
<img src="{% include static_url.fn filename='prev.gif' %}" alt="Previous"/>
<br/>{{ _prev_document.title }}
<br/>{{ _prev_document.title | escape }}
</a>
{%- endif -%}
</div><div class="document-next">
{%- if _next_document -%}
<a class="document-next-link" href="{{ site.baseurl }}{{ _next_document.url }}">
<img src="{% include static_url.fn filename='next.gif' %}" alt="Next"/>
<br/>{{ _next_document.title }}
<br/>{{ _next_document.title | escape }}
</a>
{%- endif -%}
</div>
......
......@@ -8,6 +8,18 @@
display: none;
}
&-breadcrumbs {
color: $meta-color;
margin-bottom: $medium-gap;
}
&-breadcrumb, &-breadcrumb-last {
display: inline-block;
}
&-breadcrumb::after {
content: "/";
margin: 0 $narrow-gap;
}
&-date {
color: $meta-color;
line-height: $text-line-height;
......
---
layout: document
title: Welcome
flair: in-progress
no_title: true
no_header: true
excerpt: Hello, my name is Blaine and this is my homepage. I am a
hacker/maker/whatever you call the person digging through the neighbors
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment