Welcome to Genhike Sports

Breadcrumb

← Back to the tag reference

Hand-written Includes in-depth notes

Breadcrumb breadcrumb Used inside components 8 host files / 8 calls

Render breadcrumb navigation, generated from the current page context when no parameters are passed.

breadcrumb($items = null, array $options = [])

Pages List pages Detail pages Single pages

Used in
List pages / Detail pages / Single pages
Defined in
core/tpl_functions.php:150
Core method
Tpl::breadcrumb()
How do I read these repository paths?

All paths are relative to the site root. Open core/tpl_functions.php at line 150 to see the definition of breadcrumb(). The "core method" is what the tag actually forwards to: a template writes content_list(...) and the core runs Tpl::contentList(...).

1. Fill in parameters, get the code Edit any field and the result below updates instantly; press Copy and paste it into a template. It also works without JavaScript: press Generate and the server recomputes it.

click the title to collapse / expand
Manual [['name'=>,'url'=>], ...]; auto when omitted. Home is always prepended.
Separator (escaped). When omitted it uses the admin setting "SEO - Breadcrumb separator" (seo_breadcrumb_separator, default /); an explicit argument wins (core/Tpl.php:424).
Class of the outer <nav> element, ry-breadcrumb by default; use it to hang your own theme class (core/Tpl.php:425).
Generated code

Now generating: breadcrumb

Real page previewOpen in new window

This is the real rendering of the page (real header, container, this tag output, real footer). It reloads when you change a parameter.

This is the server-computed default; it updates as you edit any parameter and the preview on the right is re-rendered too. It also works without JavaScript: fill the form and press Generate.

2. Full parameter table 3 parameters, one per row; scroll sideways on narrow screens.

click the title to collapse / expand
Parameter Type Default Description
items array null Manual [['name'=>,'url'=>], ...]; auto when omitted. Home is always prepended.
separator string From the site settings (effectively always /) Separator (escaped). When omitted it uses the admin setting "SEO - Breadcrumb separator" (seo_breadcrumb_separator, default /); an explicit argument wins (core/Tpl.php:424).
class string ry-breadcrumb (default) Class of the outer <nav> element, ry-breadcrumb by default; use it to hang your own theme class (core/Tpl.php:425).

3. Examples Every example can be copied as-is; the later ones are more advanced.

click the title to collapse / expand

Smallest working call

List, detail, and single pages all build their own trail; the output is already a landmark, so no extra nav element is needed.

<?= breadcrumb() ?>

Use a different separator

This affects one instance only; passing null as the first argument keeps the automatic trail and the admin setting stays untouched.

<?= breadcrumb(null, ['separator' => '>']) ?>

Advanced: fill in a virtual page trail

The entry without a url is the current page, and the home page is added automatically, so never list it yourself.

<?= breadcrumb([
    ['name' => 'Help center', 'url' => '/help/'],
    ['name' => 'Upgrade notes', 'url' => '/help/upgrade/'],
    ['name' => 'Version 3 migration checklist'],
]) ?>

4. What it does / when to use it

Place it under the page header of list, detail, and single pages to give visitors a way back up and to make the hierarchy clear to crawlers. With no arguments it reads the trail that the controller already computed, so list, detail, and single pages need no hand-built path; only pages whose context carries no trail, such as 404 and search results, need explicit items. The home page itself does not need a breadcrumb, and when the page header is a large image with the page title, the same words appear twice, so either move the breadcrumb into the dark header band or leave it out.

5. Which pages it belongs on This is the question clients actually ask: "I am building the home page / a list page / a detail page — which tags do I use?"

click the title to collapse / expand
Page What that page is What this tag does there
List pages Category list pages: listing, filters, pagination On a list page it lives in the list container or right next to the pagination bar.
You use it to: Place it under the page header of list, detail, and single pages to give visitors a way back up and to make the hierarch
Detail pages Content detail pages: body, specs, related items On a detail page it goes in the body area or in the related-items sidebar.
You use it to: Place it under the page header of list, detail, and single pages to give visitors a way back up and to make the hierarch
Single pages One-off pages such as About or Contact On a single page (About, Contact) it sits inside the content block.
You use it to: Place it under the page header of list, detail, and single pages to give visitors a way back up and to make the hierarch

Clicking a page name jumps to every tag for that page in the reference (the "By page" filter there). This page always shows everything about the tag, whatever that filter is set to.

6. How to use it (step by step)

  1. Put breadcrumb() at the top of the content area, usually before the page skeleton and outside its grid, then visit a list page, a detail page, and a single page to confirm all three trails are correct.
  2. Do not wrap it in your own nav element: the output is already a navigation landmark with an aria-label, and a second wrapper produces two landmarks announced twice by screen readers.
  3. Change the separator with the second argument, for example ['separator' => '>'], and leave it out to keep using the global setting from the admin.
  4. Fill in items only for virtual pages that have no matching category level, in the form [['name' => 'Help center', 'url' => '/help/'], ['name' => 'Upgrade notes']].
  5. Review the levels once more: an entry without a url renders as plain current-page text, so treat a missing url on the last entry as the convention and always set it on the middle entries.

7. Common pitfalls

  • Handing over items that already include the home page produces two home links, because the tag always prepends one. Only list the levels below the home page.
  • A missing url on a middle entry raises no error; it renders as a non-clickable span.current and looks like that level is intentionally not linked, which sends debugging in the wrong direction.
  • The name values are escaped, so markup such as strong never takes effect and its text appears literally on the page.
  • On a detail page the trailing page title repeats the main heading in the article body. Keep one of the two instead of shipping both.
  • Do not use it as category navigation: it shows a single chain from the home page to the current page and never lists sibling categories, which is what a navigation or category tag is for.

Note from the reference table The default separator comes from the admin setting "SEO - Breadcrumb separator" (seo_breadcrumb_separator, default /) and applies on the front end immediately; an explicit separator argument wins.

8. Real rendered output This section was rendered once on the server with this site real data; it is not a mock-up.

click the title to collapse / expand

This is the breadcrumb of this very page (with no arguments it uses the page context).

Open this page in a new window →

9. Where it already appears in your templates Grouped by components / page templates / template packs; the data comes from a script scan.

click the title to collapse / expand

Components 8 files / 8 calls 89% of tag calls live in components

  • templates/_shared/components/breadcrumb-bar.php ×1 lines 14
  • templates/_shared/components/breadcrumb-card.php ×1 lines 166
  • templates/_shared/components/breadcrumb-center.php ×1 lines 138
  • templates/_shared/components/breadcrumb-media.php ×1 lines 177
  • templates/_shared/components/page-hero-light.php ×1 lines 316
  • templates/_shared/components/page-hero-soft.php ×1 lines 186
  • templates/_shared/components/page-hero-split.php ×1 lines 324
  • templates/_shared/components/page-hero.php ×1 lines 58

Click "See this code + preview": the left shows the real code around that call site (±12 lines, call line highlighted) and the right renders a real page preview with the current parameters.

11. Previous / next In group order; this is tag 32 of 56.

click the title to collapse / expand
Send an Enquiry