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

@@ -6,11 +6,19 @@
//
// Component props override both.
import type { ComputedRef } from 'vue'
import type { ComputedRef, MaybeRefOrGetter } from 'vue'
import { pickLabels, type SeoLabelOverrides, type SeoLabels } from '../utils/labels.ts'
export function useSeoLabels(): ComputedRef<SeoLabels> {
/**
* The labels of the page's content locale, or of `locale` when given and
* not empty (the HTML sitemap pages know theirs from the route).
*/
export function useSeoLabels(locale?: MaybeRefOrGetter<string | undefined | null>): ComputedRef<SeoLabels> {
const answer = useSeoAnswer()
const appConfig = useAppConfig() as { seo?: { labels?: SeoLabelOverrides } }
return computed(() => pickLabels(answer.value?.locale, answer.value?.html_lang, appConfig.seo?.labels ?? {}))
return computed(() => {
const own = toValue(locale)
if (own) return pickLabels(own, '', appConfig.seo?.labels ?? {})
return pickLabels(answer.value?.locale, answer.value?.html_lang, appConfig.seo?.labels ?? {})
})
}