astro-structured-datav2.0.1

← All examples

Breadcrumbs from the URL

Rendered on /en/blog/my-post/: the language prefix is skipped, segments get labels.

Breadcrumbs from the URL

examples/auto-breadcrumbs.astro
---
import { AutoBreadcrumbSchema } from '@casoon/astro-structured-data/components';
---

<!-- Rendered on /en/blog/my-post/: the path becomes the breadcrumb trail. -->
<AutoBreadcrumbSchema
  homeLabel="Start"
  ignoreSegments={['en']}
  labels={{ 'my-post': 'My Post' }}
/>
{
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [
    {
      "@type": "ListItem",
      "position": 1,
      "name": "Start",
      "item": "https://example.com/"
    },
    {
      "@type": "ListItem",
      "position": 2,
      "name": "Blog",
      "item": "https://example.com/en/blog"
    },
    {
      "@type": "ListItem",
      "position": 3,
      "name": "My Post",
      "item": "https://example.com/en/blog/my-post"
    }
  ]
}
  • BreadcrumbList
  • AutoBreadcrumbSchema