Skip to content

Commit

Permalink
add breadcrumbs to member pages
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsu committed Aug 30, 2024
1 parent c793f46 commit 331ba66
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
30 changes: 20 additions & 10 deletions _includes/breadcrumbs.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
<div id="breadcrumbs" style="text-align: left;">
{% assign crumbs = page.url | remove:'/index.html' | split: '/' %}
<a href="/">Home</a>
{% for crumb in crumbs offset: 1 %}
{% if forloop.last %}
/ {{ page.title }}
{% else %}
/ <a href="{% assign crumb_limit = forloop.index | plus: 1 %}{% for crumb in crumbs limit: crumb_limit %}{{ crumb | append: '/' }}{% endfor %}">{{ crumb | replace:'-',' ' | remove:'.html' | capitalize }}</a>
{% endif %}
{% endfor %}
</div>
{% assign crumbs = page.url | remove:'/index.html' | split: '/' %}
<a href="/">Home</a>

{% for crumb in crumbs offset: 1 %}
{% if forloop.last %}
<!-- Last crumb is always the current page title -->
/ {{ page.title }}
{% elsif crumb == "members" and include.member %}
<!-- If the crumb is 'members' and member is passed -->
{% if include.member.group == "alum" %}
/ <a href="/team">Team</a> / <a href="/team/alumni">Alumni</a>
{% else %}
/ <a href="/team">Team</a>
{% endif %}
{% else %}
<!-- Default breadcrumb behavior -->
/ <a href="{% assign crumb_limit = forloop.index | plus: 1 %}{% for crumb in crumbs limit: crumb_limit %}{{ crumb | append: '/' }}{% endfor %}">{{ crumb | replace:'-',' ' | remove:'.html' | capitalize }}</a>
{% endif %}
{% endfor %}
</div>
7 changes: 7 additions & 0 deletions _layouts/member.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

{% capture floatcontent %}

{% assign member = site.members
| where_exp: "member", "member.slug == page.slug"
| first
%}
{% include breadcrumbs.html member=member %}
{% include section.html %}

{% include portrait.html lookup=page.slug %}

<div>
Expand Down

0 comments on commit 331ba66

Please sign in to comment.