0

I need help with Magento breadcrumbs. This is what google testing tool tells me:

Breadcrumb 1 url: http://domain.com/ title: Home Breadcrumb 2 url: http://domain.com/category/ title: Category Breadcrumb 3 title: missing and required url: missing and required

And this is breadcrumbs.phtml

<?php if($crumbs && is_array($crumbs)): ?>
<div class="breadcrumbs" xmlns:v="http://rdf.data-vocabulary.org/#">
    <ul>
        <?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
            <li class="<?php echo $_crumbName ?>" typeof="v:Breadcrumb">
            <?php if($_crumbInfo['link']): ?>
                <a rel="v:url" property="v:title" href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>"><?php echo $this->escapeHtml($_crumbInfo['label']) ?></a>
            <?php elseif($_crumbInfo['last']): ?>
                <strong><?php echo $this->escapeHtml($_crumbInfo['label']) ?></strong>
            <?php else: ?>
                <?php echo $this->escapeHtml($_crumbInfo['label']) ?>
            <?php endif; ?>
            <?php if(!$_crumbInfo['last']): ?>
                <span>/ </span>
            <?php endif; ?>
            </li>
        <?php endforeach; ?>
    </ul>
</div>
<?php endif; ?>

How can I fix it?

Thanks in advance! Ivan

4 Answers4

1

I have use this code to resolve breadcrumb issue by google console warning please click here for test : https://search.google.com/structured-data/testing-tool#

<?php
$separator = $this->getBreadcrumbsSeparator();
 ?>

    <?php if($crumbs && is_array($crumbs)): ?>
    <div class="breadcrumbs"  >
    <ul itemscope itemtype="http://schema.org/BreadcrumbList">
      <?php $i = 0; ?>
        <?php foreach($crumbs as $_crumbName=>$_crumb): ?>
 <li class="<?php echo $_crumbName ?>" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
        <?php if(!empty($_crumb['link']) && (!$_crumb['last'])): ?>
            <a  itemprop="item" href="<?php echo $_crumb['link'] ?>" title="<?php echo $this->htmlEscape($_crumb['label']) ?>" rel="v:url" property="v:title">
                <?php echo $this->htmlEscape($_crumb['label']) ?>
                  <meta itemprop="position" content="<?php echo $i; ?>">
                  <meta itemprop="name" content="<?php echo $this->escapeHtml($_crumb['label']) ?>">
            </a>
        <?php elseif($_crumb['last']): ?>
            <strong>
            <?php echo $this->htmlEscape($_crumb['label']) ?>
              <meta itemprop="position" content="<?php echo $i; ?>">
              <meta itemprop="name" content="<?php echo $this->escapeHtml($_crumb['label']) ?>">

            </strong>
        <?php else: ?>
            <?php echo $this->htmlEscape($_crumb['label']) ?>
             <meta itemprop="position" content="<?php echo $i; ?>">
             <meta itemprop="name" content="<?php echo $this->escapeHtml($_crumb['label']) ?>">
        <?php endif; ?>
        <?php if(!$_crumb['last']): ?>
            <span><?php echo $separator; ?></span>
             <meta itemprop="position" content="<?php echo $i; ?>">
             <meta itemprop="name" content="<?php echo $this->escapeHtml($_crumb['label']) ?>">
        <?php endif; ?>
        </li>
          <?php $i++; ?>
        <?php endforeach; ?>
    </ul>
</div>

Now, copy the code from a product page on your development site into the Google Web master Tools Google Structured Data. If Google can read your page then everything will be good. you can check there and if need then modify code little bit.to ckeck your code click here : https://search.google.com/structured-data/testing-tool

user2049837
  • 21
  • 1
  • 4
0

Replace your code with below code..

<?php if($crumbs && is_array($crumbs)): ?>
<div class="breadcrumbs">
<ul xmlns:v="http://rdf.data-vocabulary.org/#">
    <?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
        <li class="<?php echo $_crumbName ?>" typeof="v:Breadcrumb">
        <?php if($_crumbInfo['link']): ?>
            <a href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>" rel="v:url" property="v:title"><?php echo $this->escapeHtml($_crumbInfo['label']) ?></a>
        <?php elseif($_crumbInfo['last']): ?>
            <strong rel="v:url" property="v:title"><?php echo $this->escapeHtml($_crumbInfo['label']) ?></strong>
        <?php else: ?>
            <?php echo $this->escapeHtml($_crumbInfo['label']) ?>
        <?php endif; ?>
        <?php if(!$_crumbInfo['last']): ?>
            <span>/ </span>
        <?php endif; ?>
        </li>
    <?php endforeach; ?>
</ul>
</div>
<?php endif; ?>

Now, copy the code from a product page on your development site into the Google Web master Tools Google Structured Data. If Google can read your page then everything will be good. If not then Full Page Cache disappears them. You need to fix the problem of Magento not caching breadcrumbs. This site may help you to solve caching issue --> Fix Magento Cache Breadcrumb issue. I hope this will solve your issue. Another site to help -->> http://inchoo.net/magento/google-rich-snippets-in-magento/

Vishwas Soni
  • 467
  • 10
  • 16
  • Thank you Vishwas! I replaced the code, and now I have only one error: Breadcrumb 1 url: http://domain.com/ title: Home Breadcrumb 2 title: Product title url: missing and required Do you think I can still do something about it? – Ivan Paunovic Mar 04 '15 at 07:55
  • Please check the code between
    tag. It will be responsible for markup of the breadcrumbs. Please refer the two sites which I've given to you. I think you may have magento cache breadcrumbs issue. Please fix as i said earlier. Google will take some time to index the breadcrumbs data.
    – Vishwas Soni Mar 04 '15 at 09:04
0

You don't have a link for the last item of the breadcrumb. Google needs it to display the path instead of the URL

After <?php elseif($_crumbInfo['last']): ?>

add <a href="<?php echo $path ?>" itemprop="url"> in front of <strong> and don't forget to close the tag in the end of course </strong></a>

Hiboomedia
  • 283
  • 1
  • 7
0

I tried everything and nothing worked, so I ended up going with my own solution.

I created an override for app\design\frontend\base\default\template\page\html\breadcrumbs.phtml in my own theme and replaced this:

<?php if($crumbs && is_array($crumbs)): ?>
<div class="breadcrumbs">
    <ul>
        <?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
            <li class="<?php echo $_crumbName ?>">
                <?php if($_crumbInfo['link']): ?>
                    <a href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>"><?php echo $this->escapeHtml($_crumbInfo['label']) ?></a>
                <?php elseif($_crumbInfo['last']): ?>
                    <strong><?php echo $this->escapeHtml($_crumbInfo['label']) ?></strong>
                <?php else: ?>
                    <?php echo $this->escapeHtml($_crumbInfo['label']) ?>
                <?php endif; ?>
                <?php if(!$_crumbInfo['last']): ?>
                    <span>/ </span>
                <?php endif; ?>
            </li>
        <?php endforeach; ?>
    </ul>
</div>

With this:

<?php if($crumbs && is_array($crumbs)): ?>
<div class="breadcrumbs">
    <ul itemscope itemtype="http://schema.org/BreadcrumbList">
        <?php $i = 0; ?>
        <?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
            <li class="<?php echo $_crumbName ?>" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
                <?php if($_crumbInfo['link']): ?>
                    <a itemprop="item" href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>">
                        <?php echo $this->escapeHtml($_crumbInfo['label']) ?>
                        <meta itemprop="position" content="<?php echo $i; ?>">
                        <meta itemprop="name" content="<?php echo $this->escapeHtml($_crumbInfo['label']) ?>">
                    </a>
                <?php elseif($_crumbInfo['last']): ?>
                    <strong itemprop="item">
                        <?php echo $this->escapeHtml($_crumbInfo['label']) ?>
                        <meta itemprop="position" content="<?php echo $i; ?>">
                        <meta itemprop="name" content="<?php echo $this->escapeHtml($_crumbInfo['label']) ?>">
                    </strong>
                <?php else: ?>
                    <span itemprop="item">
                        <?php echo $this->escapeHtml($_crumbInfo['label']) ?>
                        <meta itemprop="position" content="<?php echo $i; ?>">
                        <meta itemprop="name" content="<?php echo $this->escapeHtml($_crumbInfo['label']) ?>">
                    </span>
                <?php endif; ?>
                <?php if(!$_crumbInfo['last']): ?>
                    <span>/ </span>
                <?php endif; ?>
            </li>
            <?php $i++; ?>
        <?php endforeach; ?>
    </ul>
</div>
MagentoAaron
  • 101
  • 4