Jump to main content Jump to doc navigation

Snippet for building breadcrumb-style navigation.

Good substitute for BreadCrumb works with documents from any contexts and provides a number of options for selecting resources.

Snippet has a very high speed, due to selecting only the specified elements from the database per request .


Accepts all of the properties of pdoTools and some others:

Property Default Description
&showLog 0 Show additional information on the work of the snippet . Only displayed to users logged in to the «mgr» context.
&from 0 Id of the resource from which to begin to build the breadcrumbs . This is usually the root of the site, which is "0".
&to Id of the resource with which end the breadcrumbs . By default, the id of the current page.
&exclude Comma-separated list of resource IDs that should be excluded from the output.
&toPlaceholder If not empty, the snippet will save all data to a placeholder with the same name , instead of displaying the output to the screen.
&outputSeparator  →  The character to use as a separator between the crumbs.
&tpl Name of chunk for formatting the output. If not specified, the contents of the resource fields will be printed to the screen.
&tplCurrent Chunk for formatting the current resource's crumb in the navigation .
&tplMax Chunk which is added to the end of the results, if there are more than &limit crumbs.
&tplHome Chunk for formatting the link on the home page.
&tplWrapper Chunk for formatting the wrapper, to wrap all results. Provides one placeholder: [[+output]]. It does not work in conjunction with &toSeparatePlaceholders.
&wrapIfEmpty Output the chunk wrapper &tplWrapper even if there are no results.
&showCurrent 1 Display the current document in the navigation.
&showHome 0 Display a crumb for the home page.
&showAtHome 1 Show breadcrumbs on the home page.
&hideSingle 0 Do not display the result if it is only a single crumb.
&direction ltr The direction of navigation: from left to right «ltr» or right to left «rtl», such as for Arabic.

Template Properties

Template Default
&tpl @INLINE <a href="[[+link]]">[[+menutitle]]</a>
&tplCurrent @INLINE <span>[[+menutitle]]</span>
&tplMax @INLINE <span>&nbsp;...&nbsp;</span>
&tplWrapper @INLINE <div class="breadcrumbs">[[+output]]</div>


Generation of bread crumbs for the current page:


Generation of a restricted number of items:


Snippet works well when called from pdoResources. For example, here is a chunk:


Generating page headers

pdoCrumbs can be called inside another snippet, for example, to generate the header tag of your pages.

Snippet Title:

// We define variables
if (empty($separator)) {$separator = ' / ';}
if (empty($titlefield)) {$titlefield = 'longtitle';}
if (empty($parents_limit)) {$parents_limit = 3;}
if (empty($tplPages)) {$tplPages = 'No. [[+page]] of [[+pageCount]]';}

// Key and cache settings
$cacheKey = $modx->resource->getCacheKey() . '/title_' . sha1(serialize($_REQUEST));
$cacheOptions = array('cache_key' => 'resource');

if (!$title = $modx->cacheManager->get($cacheKey, $cacheOptions)) {
    // We learn the name of the page
    $title = !empty($modx->resource->$titlefield)
        ? $modx->resource->$titlefield
        : $modx->resource->pagetitle;

    // Add a search query, if there is one
    if (!empty($_GET['query']) && strlen($_GET['query']) > 2) {
        // We need to use a placeholder to avoid
        $title .= ' «[[+mse2_query]]»';

    // Adding pagination if indicated
    if (!empty($_GET['page'])) {
        $title .= $separator . str_replace('[[+page]]', intval($_GET['page']), $tplPages);

    // Adding parents
    $crumbs = $modx->runSnippet('pdoCrumbs', array(
        'to' => $modx->resource->id,
        'limit' => $parents_limit,
        'outputSeparator' => $separator,
        'showHome' => 0,
        'showAtHome' => 0,
        'showCurrent' => 0,
        'direction' => 'rtl',
        'tpl' => '@INLINE [[+menutitle]]',
        'tplCurrent' => '@INLINE [[+menutitle]]',
        'tplWrapper' => '@INLINE [[+output]]',
        'tplMax' => ''
    if (!empty($crumbs)) {
        $title = $title . $separator . $crumbs;

    // By caching the results
    $modx->cacheManager->set($cacheKey, $title, 0, $cacheOptions);

// return title
return $title;

Call the snippet on the page

<title>[[Title]] / [[++site_name]] - my best website in the world</title>


Working Example [generate breadcrumbs in the search results] 3 mSearch2.

Also the site bezumkin.ru uses dynamic titles.

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.


  • modmore
  • modmore
  • Jens Wittmann – Gestaltung & Entwicklung
  • Raffy
  • eydolan
  • Digital Penguin
  • Fabian Christen
  • Dannevang Digital
  • deJaya
  • Sepia River Studios
  • Following Sea
  • Anton Tarasov
  • Lefthandmedia
  • Nick Clark
  • Chris Fickling
  • Murray Wood
  • YJ
  • CrewMark
  • Richard


$305 per month—let's make that $500!

Learn more