Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

breadcrumbs


douglaswalker

Recommended Posts

Hi there

hoping to pick the brains of SEO interested people here.

Breadcrumbs currently show as 

Home > Page you came from > page you are on

Or something similar. The schema picks all this up and it passes the schema test at Google.

However the page you are on is shown as a link in the breadcrumb.. so in effect it is just linking to it's self.

Is this ok for SEO... many things I have read say a page linking to itself is not such a good idea.

So my question is if I don't want it to be a link and just plain text how can i do  this and still have it pass the schema test.

I know I can just change the breadcrumb link in the code and remove the tep_href  part but then the schema doesn't pass as the breadcrumb relies on a function to produce the correctly formatted schema and that relies on the link

anyway any thoughts?

 

schema function

<?php
/*
  $Id$
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com
  Copyright (c) 2003 osCommerce
  Released under the GNU General Public License
*/
  class breadcrumb {
    var $_trail;
    function breadcrumb() {
      $this->reset();
    }
    function reset() {
      $this->_trail = array();
    }
    function add($title, $link = '') {
      $this->_trail[] = array('title' => $title, 'link' => $link);
    }
    function trail($separator = NULL) {
      $pos = 1;
      $trail_string = '<ol  itemscope itemtype="http://schema.org/BreadcrumbList" class="breadcrumb">';
      for ($i=0, $n=sizeof($this->_trail); $i<$n; $i++) {
        if (isset($this->_trail[$i]['link']) && tep_not_null($this->_trail[$i]['link'])) {
          $trail_string .= '<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="' . $this->_trail[$i]['link'] . '" itemprop="item"><span itemprop="name">' . $this->_trail[$i]['title'] . '</span></a>';
        } else {
          $trail_string .= '<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><span itemprop="name">' . $this->_trail[$i]['title'] . '</span>';
        }
        $trail_string .= '<meta itemprop="position" content="' . (int)$pos . '" /></li>' . PHP_EOL;
        $pos++;
      }      
  
      $trail_string .= '</ol>';
      return $trail_string;
    }
  }
?>

code on page to call function

$breadcrumb->add('Policies', tep_href_link('policies.php'));
  $breadcrumb->add('AfterPay', tep_href_link('afterpay.php'));

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...