View Source SEO.Breadcrumb.List (SEO v0.1.11)

A SEO.Breadcrumb.List is list of items consisting of a chain of linked Web pages, typically described using at least their URL and their name, and typically ending with the current page.

The :position property is used to reconstruct the order of the items in a SEO.Breadcrumb.List. The convention is that a breadcrumb list has an itemListOrder of ItemListOrderAscending (lower values listed first), and that the first items in this list correspond to the "top" or beginning of the breadcrumb trail, e.g. with a site or section homepage. The specific values of 'position' are not assigned meaning for a BreadcrumbList, but they should be integers, e.g. beginning with '1' for the first item in the list.

Summary

Functions

Build a list of items that represent breadcrumbs for your item.

Types

t()

@type t() :: %SEO.Breadcrumb.List{
  "@context": String.t(),
  "@type": String.t(),
  itemListElement: [SEO.Breadcrumb.ListItem.t()]
}

Functions

build(attrs, default \\ nil)

@spec build(t() | [map() | Keyword.t()] | nil, SEO.config()) :: t() | nil

Build a list of items that represent breadcrumbs for your item.

You may build the list with SEO.Breadcrumb.ListItem or with attributes that will build a ListItem. The position will be inferred from the list provided, but if you need to supply the position manually, you must supply SEO.Breadcrumb.ListItem.

For example:

SEO.Breadcrumb.List.build([
  %{name: "Posts", item: Routes.blog_url(@endpoint, :index)},
  %{name: "My Post", item: Routes.blog_url(@endpoint, :show, my_id)}
])