Skip to content

feat(): breadcrumbs #82

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/_includes/components/breadcrumbs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<ul class="breadcrumbs flex gutter list list--unstyle">
{% assign breadcrumbs = page.url | remove:'/index.html' | split: '/' %}

<li>
<a class="breadcrumbs__link" href="{{ site.baseurl }}/">Home</a>
</li>

{% for crumb in breadcrumbs offset: 1 %}
<li>/</li>

{% if forloop.last %}
<li>
{{ page.title }}
</li>
{% else %}
<li>
{% assign crumb_limit = forloop.index | plus: 1 %}

<a class="breadcrumbs__link" href="{{ site.baseurl }}{% for crumb in breadcrumbs limit: crumb_limit %}{{ crumb | remove: '.html' | append: '/' }}{% endfor %}">
{{ crumb | replace:'-',' ' | remove:'.html' | capitalize }}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
2 changes: 1 addition & 1 deletion src/_layouts/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
---

<article class="page">
{% include breadcrumb.html %}
{% include components/breadcrumbs.html %}

<div class="page__body">
{%- if page.title -%}
Expand Down
13 changes: 13 additions & 0 deletions src/_sass/components/_breadcrumbs.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.breadcrumbs {
font-size: 14px;
color: color(gray);

&__link {
color: color(gray-dark);

&:hover {
color: color(primary);
text-decoration: none;
}
}
}
1 change: 1 addition & 0 deletions src/_sass/segment.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
@import "components/list-steps";
@import "components/input";
@import "components/field";
@import "components/breadcrumbs";
@import "components/highlight";

// Pages
Expand Down