Adding microdata or schema org for breadcrumb SEO in Drupal 7

0 votes

I'm currently a little confused about microdata and schema.org. Is microdata and schema.org the same? I read the Google and Microsoft documentation, but that didn't helped me to get the difference between this two names.

So far I understood this I have produced this HTML code:

<span itemscope itemtype="https://schema.org/BreadcrumbList">
 <a href="/" itemprop="url"><span itemprop="title">My Page</span></a>
</span>
<span itemscope itemtype="https://schema.org/BreadcrumbList">
 <a href="/cat1" itemprop="url"><span itemprop="title">Category 1</span></a>
</span>
<span itemscope itemtype="https://schema.org/BreadcrumbList">
 <a href="/cat1/content" itemprop="url"><span itemprop="title">Content</span></a>
</span>

In my opinion too much overhead but okay if the search results look nice. Is it possible to reduce the count of html code?

Also if I don't need that how does the search engines detect two different trails?

My next problem is that I want to apply this format to the drupal breadcrumps. I found on the web this fix which I tried to include to my own SEO module like this:

function mymod_page_alter(&$variables) {
    if (!isset($variables['breadcrumb'])) {
        $variables['breadcrumb'] = theme('my_microdata', array('breadcrumb' => drupal_get_breadcrumb()));
    }
}
function mymod_theme($existing, $type, $theme, $path) {
  return array(
    'my_microdata' => array(
     'variables' => array('breadcrumb' =>array()),
    ),
  );
}
function mymod_menu_breadcrumb_alter(&$active_trail, $item){
  foreach($active_trail as $id=>$active_trail_item){
    $active_trail[$id]['localized_options']['attributes']['itemprop'][]="url";
  }
}
function theme_my_microdata($variables){
 $breadcrumb=$variables['breadcrumb'];
print_r(debug_backtrace());
 $output="*+*+*+*+*";
  if (!empty($breadcrumb)) {
    // Provide a navigational heading to give context for breadcrumb links to
    // screen-reader users. Make the heading invisible with .element-invisible.
    $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
    $output .= '<div class="breadcrumb">';
    $separator="";
    foreach($breadcrumb as $breadcrumb_item){
      $output.='<span typeof="datav:Breadcrumb">'.$separator.$breadcrumb_item."</span>";
      $separator="»";
    }
    $output .='</div>';
  }

    return $output."xXxXxXx";
}

So far I checked that all this code is executed. But this theming is not applied on my page. Why does that code not work? Could this been related with the module breadcrumb? I know that this output will be garbage but I cannot see the result.

If I guess right than is the output created by theme.inc line 1682ff theme_breadcrumb(...)instead of my code.

It would be nice if somebody could help me, also if you don’t know all answers of my questions!

Mar 4, 2022 in Digital Marketing by Kichu
• 19,040 points
792 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Digital Marketing

0 votes
0 answers

Adding the CANONICAL tag to my page for SEO through code behind?

I am using ASP.NET with MasterPages. Thus ...READ MORE

Mar 3, 2022 in Digital Marketing by Kichu
• 19,040 points
1,310 views
0 votes
0 answers

SEO: Subdomains or subfolders for Wiki?

I'm currently working on a multilingual Wiki ...READ MORE

Mar 4, 2022 in Digital Marketing by Kichu
• 19,040 points
348 views
0 votes
0 answers

Text should be kept in ppt, pdf, or on html pages to get more SEO benefits and good results at SERP

best method/option for the text to be ...READ MORE

Mar 6, 2022 in Digital Marketing by Kichu
• 19,040 points
561 views
0 votes
0 answers

SEO URL for information pages in opencart not working

I'm trying to create custom SEO URL's ...READ MORE

Mar 8, 2022 in Digital Marketing by Kichu
• 19,040 points
852 views
0 votes
1 answer

Will a .com domain name gain advantage over a .be domain name in SEO results for Americans

Yes, this will affect the SEO. The ...READ MORE

answered Mar 11, 2022 in Digital Marketing by narikkadan
• 63,680 points
673 views
0 votes
1 answer

Google Rich Snippets for logo and website description

1. implement the Rich Snippets. 2. Create a sitemap ...READ MORE

answered Mar 12, 2022 in Digital Marketing by narikkadan
• 63,680 points
657 views
0 votes
1 answer

array of LocalBusinessJsonLd Schema using next-seo

specify the unique keyoverride properties if you ...READ MORE

answered Feb 14, 2022 in Others by narikkadan
• 63,680 points
1,037 views
0 votes
0 answers

Can I remove the JSON-LD schema that Yoast adds to my WordPress site?

would like to remove the JSON-LD schema ...READ MORE

Mar 3, 2022 in Digital Marketing by Kichu
• 19,040 points
989 views
0 votes
1 answer

Metadescription Drupal

It's a pretty easy and direct solution. ...READ MORE

answered Mar 12, 2022 in Digital Marketing by narikkadan
• 63,680 points
641 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP