5

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="http://data-vocabulary.org/Breadcrumb">
 <a href="/" itemprop="url"><span itemprop="title">My Page</span></a>
</span>
<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
 <a href="/cat1" itemprop="url"><span itemprop="title">Category 1</span></a>
</span>
<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
 <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!

rekire
  • 47,260
  • 30
  • 167
  • 264
  • 1
    Great question about the markup, but I think you should take out the stuff about Drupal and move it in a separate question – Baumr Jul 04 '13 at 08:56

1 Answers1

10

Is microdata and schema.org the same?

No they are not!

Microdata is a WHATWG html specification. It's supose to make it easier for computers to read the content of the document.

Schema.org is a vocabulary that is used to describe an item. Schema.org is introduced by Bing, Google and Yahoo.

http://en.wikipedia.org/wiki/Microdata_(HTML)

http://www.w3.org/TR/html5/microdata.html

http://schema.org/

Is it possible to reduce the count of html code?

Have a look at the exemple code at schema.org for the markup of a WebPage item: http://schema.org/WebPage

<body itemscope itemtype="http://schema.org/WebPage">
...
<div itemprop="breadcrumb">
  <a href="category/books.html">Books</a> >
  <a href="category/books-literature.html">Literature & Fiction</a> >
  <a href="category/books-classics">Classics</a>
</div>

How does the search engines detect two different trails

If you use the above example from schema.org instead you mark up a trail instead of individual links. If you mark up two trails they will both be recognized as two individual ones. (Or at least should be)

Why does that code not work?

I think this question should be separated from this post and asked in a different one. I'm not familiar with drupal and some of the people that can answer questions regarding microdata don't even know PHP.

superhero
  • 6,281
  • 11
  • 59
  • 91
  • If I try to use your example in http://www.google.com/webmasters/tools/richsnippets the breadcrumps are not recognised. If I exchange the `>` with a other char e.g. `-` the breadcrumb is detected but not recognised. – rekire Apr 29 '12 at 16:28
  • @rekire I don't know how you can have that problem. I copy pasted the example code I wrote in the answer to the text editor with out a problem. – superhero Apr 29 '12 at 19:19
  • Sorry for the delay. Here is the [result page](http://www.google.com/webmasters/tools/richsnippets?url=http%3A%2F%2Ffiddle.jshell.net%2FFEhcE%2Fshow%2F) with my trouble based on [this fiddle](http://jsfiddle.net/FEhcE/). As you can see google shows: *fiddle.jshell.net/FEhcE/show/* instat of *fiddle.jshell.net > Literature & Fiction > Classics*. – rekire May 01 '12 at 08:43
  • I see what you mean now. I wouldn't spend to much time on solving that. It's a correct way of doing it with schema.org. The tool is in beta and can be seen more as a light in the dark, if you ask me. I've seen pages with displayed breadcrumbs in search result but that has no recognized data by this tool at all. It's more likely google understands breadcrumbs in means that is not publicly shared. – superhero May 02 '12 at 05:34
  • @rekire Have you looked at the example Google has for data-vocabulary.org on this page? http://support.google.com/webmasters/bin/answer.py?hl=en&answer=185417&topic=1088474&ctx=topic – superhero May 03 '12 at 01:00
  • Yes I saw this page too. I just want to force that the breadcrumps are detected. – rekire May 03 '12 at 05:24
  • Schema it could be better, but it doesn't convince me. As you can see in the []() regarding [this fiddle](http://jsfiddle.net/marcopanichi/Utfy9/), the breadcrumb is better read by the search engines using the **data-vocabulary.org** format – Marco Panichi Jul 08 '13 at 15:23
  • @MarcoPanichi I agree that search engines seems to like data-vocabulary.org more. The answer aims for a reduced and simpler markup then provided in the question. An alternative using data-vocabulary.org would make the answer more complete though. – superhero Jul 08 '13 at 16:00