SEO.JSONLD.Breadcrumbs (SEO v0.3.0-rc.0)

View Source

Convenience wrapper for building a Schema.org SEO.JSONLD.BreadcrumbList from a compact list of breadcrumb entries.

Takes a flat list of %{name: ..., item: ...} maps (or keyword lists) and produces the full BreadcrumbList + ListItem hierarchy with sequential position values inferred from the list order (1-based).

Example

SEO.JSONLD.Breadcrumbs.build([
  %{name: "Home", item: "https://example.com/"},
  %{name: "Blog", item: "https://example.com/blog/"},
  %{name: "This Post", item: "https://example.com/blog/post-1"}
])

For full control (custom positions, extra ListItem fields like image), use SEO.JSONLD.BreadcrumbList and SEO.JSONLD.ListItem directly.

Summary

Functions

Build a BreadcrumbList JSON-LD map from a list of breadcrumb entries.

Functions

build(items)

@spec build([map() | keyword()]) :: map()

Build a BreadcrumbList JSON-LD map from a list of breadcrumb entries.

Each entry should be a map or keyword list with:

  • :name - the breadcrumb label (required)
  • :item - the URL for the breadcrumb target, either a string or URI.t()