diff --git a/path_breadcrumbs.module b/path_breadcrumbs.module
index c48cf30..b5eb72b 100644
--- a/path_breadcrumbs.module
+++ b/path_breadcrumbs.module
@@ -339,7 +339,7 @@ function path_breadcrumbs_breadcrumb($variables) {
}
// Add options for rich snippets.
- $elem_tag = 'span';
+ $elem_tag = 'li';
$elem_property = '';
$root_property = '';
$options = array('html' => TRUE);
@@ -347,22 +347,27 @@ function path_breadcrumbs_breadcrumb($variables) {
if ($snippet == PATH_BREADCRUMBS_RICH_SNIPPETS_RDFA) {
// Add link options for RDFa support.
- $options['attributes'] = array('rel' => 'v:url', 'property' => 'v:title');
+ $options['attributes'] = array(
+ 'property' => 'ListItem',
+ 'typeof' => 'WebPage',
+ );
$options['absolute'] = TRUE;
// Set correct properties for RDFa support.
- $elem_property = ' typeof="v:Breadcrumb"';
- $root_property = ' xmlns:v="http://rdf.data-vocabulary.org/#"';
+ $elem_property = ' property="itemListElement" typeof="ListItem"';
+ $root_property = ' vocab="http://schema.org/" typeof="BreadcrumbList"';
}
elseif ($snippet == PATH_BREADCRUMBS_RICH_SNIPPETS_MICRODATA) {
// Add link options for microdata support.
- $options['attributes'] = array('itemprop' => 'url');
+ $options['attributes'] = array('itemprop' => 'item');
$options['absolute'] = TRUE;
// Set correct properties for microdata support.
- $elem_property = ' itemscope itemtype="http://data-vocabulary.org/Breadcrumb"';
- $elem_tag = 'div';
+ $elem_property = ' itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"';
+ $elem_tag = 'li';
+
+ $root_property = ' itemscope itemtype="http://schema.org/BreadcrumbList"';
// Add style that will display breadcrumbs wrapped in
inline.
drupal_add_css(drupal_get_path('module', 'path_breadcrumbs') . '/css/path_breadcrumbs.css');
@@ -425,10 +430,16 @@ function path_breadcrumbs_breadcrumb($variables) {
// Get breadcrumb title from a link like "
title".
$title = trim(strip_tags($breadcrumb));
+ $meta = '';
// Wrap title in additional element for microdata support.
if ($snippet == PATH_BREADCRUMBS_RICH_SNIPPETS_MICRODATA) {
- $title = '
' . $title . '';
+ $title = '
' . $title . '';
+ $meta .= '
';
+ }
+ elseif ($snippet == PATH_BREADCRUMBS_RICH_SNIPPETS_RDFA) {
+ $title = '
' . $title . '';
+ $meta .= '
';
}
// Support title attribute.
@@ -446,14 +457,15 @@ function path_breadcrumbs_breadcrumb($variables) {
// Build new text or link breadcrumb.
$new_breadcrumb = !empty($href) ? l($title, $href, $options) : $title;
-
// Replace old breadcrumb link with a new one.
- $breadcrumbs[$key] = '<' . $elem_tag . ' class="' . implode(' ', $classes) . '"' . $elem_property . '>' . $new_breadcrumb . '' . $elem_tag . '>';
+ $breadcrumbs[$key] = '<' . $elem_tag . ' class="' . implode(' ', $classes) . '"' . $elem_property . '>' . $new_breadcrumb . $meta . '' . $elem_tag . '>';
}
// Get breadcrumb delimiter and wrap it into
for customization.
- $delimiter = variable_get('path_breadcrumbs_delimiter', 'ยป');
- $delimiter = '' . trim($delimiter) . '';
+ $delimiter = variable_get('path_breadcrumbs_delimiter');
+ if ($delimiter) {
+ $delimiter = '' . trim($delimiter) . '';
+ }
$classes = array('breadcrumb');
@@ -463,14 +475,23 @@ function path_breadcrumbs_breadcrumb($variables) {
if (user_access('administer path breadcrumbs') && $path_breadcrumbs_data && isset($path_breadcrumbs_data->variant)) {
$contextual_links = array(
'#type' => 'contextual_links',
- '#contextual_links' => array('path_breadcrumbs' => array('admin/structure/path-breadcrumbs/edit', array($path_breadcrumbs_data->variant->machine_name))),
+ '#contextual_links' => array(
+ 'path_breadcrumbs' => array(
+ 'admin/structure/path-breadcrumbs/edit',
+ array($path_breadcrumbs_data->variant->machine_name),
+ )
+ ),
);
$prefix = drupal_render($contextual_links);
$classes[] = 'contextual-links-region';
}
+ $crumbs_amount = variable_get('path_breadcrumbs_display_amount', FALSE);
+ if ($crumbs_amount) {
+ $classes[] = 'breadcrumbs-amount-' . count($breadcrumbs);
+ }
// Build final version of breadcrumb's HTML output.
- $output .= '' . $prefix . implode(" $delimiter ", $breadcrumbs) . '
';
+ $output .= '' . $prefix . implode(" $delimiter ", $breadcrumbs) . '
';
return $output;
}