Overview
The CustomisedBreadCrumbs component provides breadcrumb navigation that shows the user’s current location in the site hierarchy. It uses theastro-breadcrumbs package with a custom chevron separator for better visual design.
Implementation
Location:src/components/CustomisedBreadCrumbs.astro
The component wraps the astro-breadcrumbs package and customizes the separator with an SVG chevron icon.
Key Features
- Automatic path generation - Breadcrumbs are generated from the current URL
- Custom separator - Uses a chevron icon instead of default separator
- Accessibility - Includes ARIA labels and semantic markup
- Responsive design - Works on all screen sizes
Dependencies
This component requires theastro-breadcrumbs package:
Usage
The breadcrumbs are used in theIndexPageLayout component to show navigation context:
src/layouts/IndexPageLayout.astro
Example Page Structure
For a page at/books/the-lean-startup, the breadcrumbs would display:
Props
The component accepts no props. It automatically generates breadcrumbs based on the current page URL.Breadcrumbs Component Props
The underlyingBreadcrumbs component uses:
separatorAriaHidden={false}- Makes separator visible to screen readersariaLabel="breadcrumbs"- Provides accessible label
Customization
Change Separator Icon
Replace the SVG in theseparator slot:
Styling Options
The component imports default styles from the package:- Override the CSS in your global styles
- Remove the import and write custom styles
- Use Tailwind classes via the package’s styling options
Example: Custom Styling
Separator Icon Details
The chevron separator uses these attributes:width="24" height="24"- Icon dimensionsstroke="currentColor"- Uses current text colorstroke-width="2"- Medium stroke weightstroke-linecap="round"- Rounded line endingsstroke-linejoin="round"- Rounded cornerspoints="9 18 15 12 9 6"- Creates right-pointing chevron
Integration
Breadcrumbs appear on:- Individual pages - Blog posts, projects, books
- Index pages - Collection listings
- Content pages - Any page using
IndexPageLayout
- Homepage - No parent navigation needed
- Base layouts - Only in index/content layouts
Accessibility
- Uses semantic breadcrumb navigation
- ARIA label provides context (
ariaLabel="breadcrumbs") - Separator is accessible to screen readers (
separatorAriaHidden={false}) - Links are keyboard navigable
- Current page is styled differently from parent pages
astro-breadcrumbs Package
This component uses theastro-breadcrumbs package which:
- Automatically generates breadcrumbs from URL structure
- Supports custom separators via slots
- Provides accessible markup out of the box
- Works with Astro’s routing system
- Includes default styling