feat: breadcrumbs component

- <SeoBreadcrumbs> (UI-SPEC L1): the resolve answer's trail as nav > ol
  with server-rendered links and the last item as aria-current text;
  nothing with fewer than two items, with page meta seo.breadcrumbs false
  or with the option seo.breadcrumbs false; props items, label,
  hideCurrent, locale
- one trail per page: the first rendered instance claims it
  (seoClaimBreadcrumbs, kept per path)
- seoSitePath: same-origin CMS URLs become paths, non-http(s) URLs are
  never links; useSeoLabels takes an optional locale
- L1 default styles with CSS-generated separators
This commit is contained in:
Jakub Zych
2026-11-04 11:59:17 +01:00
parent 3abc986f42
commit ebb0c8084e
9 changed files with 222 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
/* SEO layer base styles. Only .seo-* classes, never a bare element or
another layer's classes; values come from seo-tokens.css, and the app's
own CSS (loaded after the layers') wins. The breadcrumb, pagination and
HTML sitemap rules land with their components. */
own CSS (loaded after the layers') wins. Long names and titles wrap and
are never truncated: the full text stays in the HTML. */
/* Visually hidden, still read by screen readers (the new-tab hint inside
external links, labels of icon-only controls). */
@@ -26,3 +26,33 @@
outline: 2px solid var(--seo-color-accent);
outline-offset: 2px;
}
/* L1 breadcrumbs: a wrapping row, separators generated here (never read by
screen readers), the current page muted and bold. */
.seo-breadcrumbs {
font-size: var(--seo-font-size-small);
}
.seo-breadcrumbs__list {
display: flex;
flex-wrap: wrap;
align-items: center;
list-style: none;
margin: 0 0 var(--seo-space-4);
padding: 0;
}
.seo-breadcrumbs__item {
overflow-wrap: anywhere;
}
.seo-breadcrumbs__item + .seo-breadcrumbs__item::before {
content: var(--seo-breadcrumbs-separator) / '';
color: var(--seo-color-muted);
padding-inline: var(--seo-space-2);
}
.seo-breadcrumbs__link {
display: inline-block;
padding-block: var(--seo-space-1);
}
.seo-breadcrumbs__current {
color: var(--seo-color-muted);
font-weight: 600;
}