-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The DY Breadcrumbs plugin for the GetSimple CMS content management system allows you to add a breadcrumbs navigation element to your website pages , which is designed to show the user their current location on the website, taking into account the nesting level of the pages. Possibilities
- Full support for Fancy URLs mode: DY Breadcrumbs fully supports the Fancy URLs feature in GetSimple CMS, providing the ability to navigate using CHPU (human-readable URLs);
- Unlimited nesting level: DY Breadcrumbs allows you to display the navigation chain for a page located at any nesting level supported by GetSimple CMS (with the Fancy URLs option enabled, the generated URLs also contain the entire chain of parent pages);
- Maintaining page privacy: all parent pages marked as “private” are not displayed in the navigation chain and are not included in the generated URLs (if the Fancy URLs option is enabled);
- Full control over design: DY Breadcrumbs does not use predefined design styles and specified separators in the generated HTML code, which gives complete freedom when embedding the navigation chain into the used website design theme;
- Microdata support: starting with DY Breadcrumbs 1.4 , the generated breadcrumb trail is marked up in accordance with the schema.org vocabulary requirements.
To display breadcrumbs, you should place a call to the PHP function in the page design template file or component:
dyGetBreadcrumbs(string $slug = '' , boolean $home = true , string $homeTitle = '' , integer $parentTitleLength , integer $currentTitleLength , boolean $fullPath = false , boolean $useMicrodata = true , boolean $useMenuData = false , string $ tag = 'li' )
The parameters accepted by the dyGetBreadcrumbs function are:
Variable | Description |
---|---|
string $slug
|
The address of the page for which the navigation chain is formed. If an empty string, the address of the current page is used (only starting with version 1.5, in earlier versions of the plugin, specifying the page address is mandatory) |
boolean $home
|
If true, the site's home page is included in the breadcrumb trail as a root element, even if it is not part of the page's descendant tree. |
string $homeTitle
|
The name used for the root item of the breadcrumb trail. If not specified, the name from the language file is used. |
integer | Sets the length of the titles for parent items in the breadcrumb trail. If 0, full titles are displayed. |
integer | Sets the length of the page title in the breadcrumb trail. If 0, the full title is displayed. |
boolean | If true, page addresses include the entire chain of parent pages, otherwise only the immediate parent page (recommended value) |
boolean | If true, the breadcrumb HTML markup uses microdata (schema.org vocabulary) |
boolean | If true, parent items in the breadcrumb use the titles set for use in the menu, otherwise the standard page titles are used. |
string $tag
|
HTML tag used to form navigation chain elements. By default, the li tag is used. |
The dyGetBreadcrumbs function will print a set of list items (page links enclosed in tags <li>
) to the page, so the function call should be enclosed in HTML <ul>
or <ol>
.
An example of using DY Breadcrumbs to display breadcrumbs on the current page of a website:
<ol>
<?php dyGetBreadcrumbs(get_page_slug(false), true, 'Home', 0, 0, false, false, false); ?>
</ol>
As a result of executing the above code, the following bulleted list will be generated:
<ol>
<li><a href="http://dimayakovlev.ru/">Home</a></li>
<li><a href="http://dimayakovlev.ru/parent-page/">Parent page</a><li>
<li class="current active">Child page</li>
</ol>
Semantic markup using microdata (schema.org vocabulary) can be used to create a navigation chain. In this case, the generated HTML code for the navigation chain looks like this:
<ol itemscope itemtype="https://schema.org/BreadcrumbList">
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
<a itemprop="item" href="http://dimayakovlev.ru/"><span itemprop="name">Home</span></a><meta itemprop="position" content="1" />
</li>
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
<a itemprop="item" href="http://dimayakovlev.ru/parent-page"><span itemprop="name">Parent page</span></a><meta itemprop="position" content="2" />
</li>
<li class="current active" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
<span itemprop="name">Child page</span><meta itemprop="position" content="3" />
</li>
</ol>
To customize the appearance of breadcrumbs to best integrate them into your website theme, you should use CSS rules and selectors. DY Breadcrumbs and Bootstrap
When using DY Breadcrumbs with the Bootstrap framework, simply add the breadcrumbs class to the element wrapping the list you're displaying:
<ol class="breadcrumbs" itemscope itemtype="https://schema.org/BreadcrumbList">
<?php dyGetBreadcrumbs(get_page_slug(false)); ?>
</ol>