PhoenixPageMeta.Breadcrumb (PhoenixPageMeta v0.1.0)

Copy Markdown View Source

A single entry in a breadcrumb trail, plus the builder.

Struct fields

  • :title — the resolved breadcrumb title (:breadcrumb_title from the source page, falling back to :title).
  • :path — the page path, copied from the source.
  • :first?true for the first item in the visible trail.
  • :last?true for the current page (last item in the visible trail).
  • :page_meta — the original PageMeta struct, for access to project- specific fields like :icon.

Building

PhoenixPageMeta.Breadcrumb.build(page_meta)
# most projects call via the wrapper:
MyAppWeb.PageMeta.breadcrumbs(page_meta)

Walks the :parent chain from the current page to the root, returns a list of %PhoenixPageMeta.Breadcrumb{} structs in root-first order.

Pages with :skip_breadcrumb set to true are filtered from the list. This is useful for modal or overlay routes that should not appear as a stack push — the breadcrumb shows the underlying page as the current one.

Rendering

Use PhoenixPageMeta.Components.Breadcrumbs.list/1 for accessible markup with slot-based styling.

Summary

Functions

Builds a breadcrumb trail from a PageMeta struct.

Types

t()

@type t() :: %PhoenixPageMeta.Breadcrumb{
  first?: boolean(),
  last?: boolean(),
  page_meta: struct(),
  path: String.t(),
  title: String.t()
}

Functions

build(page_meta)

@spec build(struct()) :: [t()]

Builds a breadcrumb trail from a PageMeta struct.

Walks the :parent chain, filters out pages with :skip_breadcrumb set, and returns root-first list of %PhoenixPageMeta.Breadcrumb{}.

Raises if any parent in the chain has a nil path.