Skip to content

Commit

Permalink
feat: added breadcrump slug overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin Heilemann committed Mar 1, 2020
1 parent 5a0bfd7 commit ce2f4ff
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/Breadcrumb.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ const Breadcrumb = () => {
return <div id="breadcrumb"></div>
}

const slugOverrides = {
about: 'About Me',
lifephases: 'Life Phases',
}

// skip first; `arr.shift()` does not work here
const [, ...items] = crumbs

Expand All @@ -22,11 +27,11 @@ const Breadcrumb = () => {
</span>,
location === pathname ? (
<span key={index} className="breadcrumb__item">
{titleize(crumbLabel || label)}
{slugOverrides[label] || titleize(crumbLabel || label)}
</span>
) : (
<Link key={index} className="breadcrumb__item breadcrumb__link" to={pathname}>
{titleize(label)}
{slugOverrides[label] || titleize(label)}
</Link>
),
])}
Expand Down

0 comments on commit ce2f4ff

Please sign in to comment.