Authored on
- Log in to post comments
Websites may benefit from the use of structured data. One of the components recognized by search engines are Breadcrumbs, a hierarchical navigation structure for showing depth of the current content.
Requires: pdoTools to be installed using the Extras Installer in your MODX Manager.
Implementation
The following can be placed in a template, resource, or chunk.
[[!pdoCrumbs?&tpl=`@INLINE<li class="breadcrumb-item" aria-current="page"> <a href="[[+link]]">[[+pagetitle]]</a></li>`&tplCurrent=`@INLINE<li class="breadcrumb-item active font-weight-bold text-uppercase disabled" aria-current="page">[[+pagetitle]]</li>`&tplMax=`@INLINE <span> ... </span>`&tplHome=`@INLINE<li class="breadcrumb-item" aria-current="page"> <a href="[[++site_url]]">Home</a></li>`&tplWrapper =`@INLINE<nav aria-label="breadcrumb" role="navigation" class="mb-4"> <div class="container clearfix"> <div class="row float-end"> <ol class="breadcrumb bg-white border-bottom border-top border-dark"> [[+output]] </ol> </div> </div></nav>` &showHome=`1`&showAtHome=`0`&scheme=`1`]][[!pdoCrumbs?&scheme=`https`&tpl=`@INLINE{"@type": "ListItem","position": [[+idx]],"name": "[[+pagetitle]]","item": "[[++site_url]][[+link]]"},`&tplCurrent=`@INLINE{"@type": "ListItem","position": [[+idx]],"name": "[[+pagetitle]]","item": "[[++site_url]][[+link]]"}`&tplHome=`@INLINE{"@type": "ListItem","position": [[+idx]],"name": "Home","item": "[[++site_url]]"},`&tplWrapper =`@INLINE<script type="application/ld+json"> { "@context": "https://schema.org", "@type": "BreadcrumbList", "name":"[[++sitename]] Breadcrumbs", "itemListElement": [ [[+output]] ] }</script>` &showHome=`1`&showAtHome=`0`&scheme=`1`]]