Skip to content

Commit 5ea85b0

Browse files
bart-krakowskijedrzejchalubek
authored andcommitted
feat(): breadcrumbs (#82)
1 parent e0443a7 commit 5ea85b0

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<ul class="breadcrumbs flex gutter list list--unstyle">
2+
{% assign breadcrumbs = page.url | remove:'/index.html' | split: '/' %}
3+
4+
<li>
5+
<a class="breadcrumbs__link" href="{{ site.baseurl }}/">Home</a>
6+
</li>
7+
8+
{% for crumb in breadcrumbs offset: 1 %}
9+
<li>/</li>
10+
11+
{% if forloop.last %}
12+
<li>
13+
{{ page.title }}
14+
</li>
15+
{% else %}
16+
<li>
17+
{% assign crumb_limit = forloop.index | plus: 1 %}
18+
19+
<a class="breadcrumbs__link" href="{{ site.baseurl }}{% for crumb in breadcrumbs limit: crumb_limit %}{{ crumb | remove: '.html' | append: '/' }}{% endfor %}">
20+
{{ crumb | replace:'-',' ' | remove:'.html' | capitalize }}
21+
</a>
22+
</li>
23+
{% endif %}
24+
{% endfor %}
25+
</ul>

src/_layouts/page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
---
44

55
<article class="page">
6-
{% include breadcrumb.html %}
6+
{% include components/breadcrumbs.html %}
77

88
<div class="page__body">
99
{%- if page.title -%}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.breadcrumbs {
2+
font-size: 14px;
3+
color: color(gray);
4+
5+
&__link {
6+
color: color(gray-dark);
7+
8+
&:hover {
9+
color: color(primary);
10+
text-decoration: none;
11+
}
12+
}
13+
}

src/_sass/segment.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
@import "components/list-steps";
5353
@import "components/input";
5454
@import "components/field";
55+
@import "components/breadcrumbs";
5556
@import "components/highlight";
5657

5758
// Pages

0 commit comments

Comments
 (0)