Duplicate Title Tags

  • Posts: 41
  • Thank you received: 0
11 years 8 months ago #95320

So I have question around duplicate title tags and the brand listing and the browse products listing.

For about 150 products we have duplicate title tags that all pretty much look like this.

/browse-products/product/575-bleeker-street-sofa-table
/shop-by-brands/product/575-bleeker-street-sofa-table


Same product but different path. pretty common to have a browse product link and a shop by brands type of link in a e-commerce site. I installed sh404 hoping in would solve this issue but we're still getting these duplicate title tags. Any ideas? Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 8 months ago #95335

Hi,

That's normal. Two menus, two different URLs.
It's not really a problem.

If you're concerned about SEO, simply configure the main one in the canonical field of the product so that search engines don't rank down the pages because of similar content.

Please Log in or Create an account to join the conversation.

  • Posts: 84
  • Thank you received: 0
11 years 7 months ago #96300

Hello, I write here because I have the same problem.
Where I can find canonical url in the product detail page?
There is a field URL but is not insert rel=canonical in the html page and I supposed this is the url of the producer.
There is another form to insert canonical url?

Then, with sh4040sef I create a custom url: is this custom url I have to insert in canonical form?

Thank you

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #96383

The canonical url option is in the version 2.1.1 of HikaShop. Thanks to download and install this version.
You have to use the sh404sef created url.

Please Log in or Create an account to join the conversation.

  • Posts: 84
  • Thank you received: 0
11 years 7 months ago #96405

The version 2.1.1 add the following line in <head> section in the page of the product

<base href=" www.example.com/produc " />

Canonical url is in the same position, but the tag is different, it's like following

<link rel="canonical" href=" www.example.com/product"/ >

This is what we need for seo optimization.

What <base> tag is for?I supposed this is not what canonical url should be.
Thank you.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #96458

We are not adding <base ...> tag, we add a canonical link, like on the screenshot:

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 84
  • Thank you received: 0
11 years 7 months ago #96479

Sorry but I inserted the canonical url in the product page but I cannot see any reference in html
Have a check the image and then check this url please

www.actionstyleclothing.com/abbigliament...hirts/secret-society

In the html code there is not canonical reference(I did not find it)

Thank you

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #96551

Had you edited the view "product / show" before updating to 2.1.1 ?

Thanks to check if you have the code:

<?php
if(isset($this->element->product_canonical) && !empty($this->element->product_canonical)){
	
	$parsedCanonical = parse_url($this->element->product_canonical);
	$parsedCurrent = parse_url(JURI::base());
	
	if(!isset($parsedCanonical['query']))
		$endUrl = $parsedCanonical['path'];
	else
		$endUrl = $parsedCanonical['path'].'?'.$parsedCanonical['query'];
	
	$canonicalUrl = $parsedCurrent['scheme'].'://'.$parsedCurrent['host'].$endUrl;

	$doc =& JFactory::getDocument();
	$doc->addCustomTag( '<link rel="canonical" href="'.$canonicalUrl.'" />' );
}
?>
at the top of the view.

Please Log in or Create an account to join the conversation.

  • Posts: 84
  • Thank you received: 0
11 years 7 months ago #96574

Sorry to post such long code, this is my product/show view,I edited it before update 2.1.1.
I tryed also to add the code you wrote in the top of that view but without success.
Thanks for help

<?php
/**
 * @package  HikaShop for Joomla!
 * @version  2.1.0
 * @author  hikashop.com
 * @copyright  (C) 2010-2012 HIKARI SOFTWARE. All rights reserved.
 * @license  GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div id="hikashop_product_<?php echo @$this->element->product_code; ?>_page" class="hikashop_product_page">
<?php
$app = JFactory::getApplication();
if (empty ($this->element)) {
  $app->enqueueMessage(JText::_('PRODUCT_NOT_FOUND'));
} else {
  if(!empty($this->links->previous))
    echo "<a title='".JText :: _('PREVIOUS_PRODUCT')."' href='".$this->links->previous."'><span class='hikashop_previous_product'></span></a>";
  if(!empty($this->links->next))
    echo "<a title='".JText :: _('NEXT_PRODUCT')."' href='".$this->links->next."'><span class='hikashop_next_product'></span></a>";
  echo "<div class='clear_both'></div>";
?>
<form action="<?php echo hikashop_completeLink('product&task=updatecart'); ?>" method="post" name="hikashop_product_form" enctype="multipart/form-data">
<?php
  $this->variant_name ='';
  if(!empty($this->element->variants)&&$this->config->get('variant_increase_perf',1)&&!empty($this->element->main)){
    foreach (get_object_vars($this->element->main) as $name=>$value) {
      if(!is_array($name)&&!is_object($name)){
        if(empty($this->element->$name)){
          if($name=='product_quantity' && $this->element->$name==0){
            continue;
          }
          $this->element->$name=$this->element->main->$name;
        }
      }
    }
  }
  $this->setLayout($this->productlayout);
  echo $this->loadTemplate();
?>
<?php if($this->productlayout != 'show_tabular'){ ?>
  <input type="hidden" name="cart_type" id="type" value="cart"/>
  <input type="hidden" name="add" value="1"/>
  <input type="hidden" name="ctrl" value="product"/>
  <input type="hidden" name="task" value="updatecart"/>
  <input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url)));?>"/>
</form>
<?php 
$config =& hikashop_config();
if($config->get('enable_status_vote') == "comment" || $config->get('enable_status_vote') == "two" || $config->get('enable_status_vote') == "both" ){ ?>
<form action="<?php echo hikashop_currentURL() ?>" method="post" name="hikashop_comment_form">
  <div id="hikashop_product_vote_listing" class="hikashop_product_vote_listing">
    <?php
    if($this->params->get('show_vote_product')){
      $js = '';
      if(isset($this->element->main)){
        $product_id = $this->element->main->product_id;
      }else{
        $product_id = $this->element->product_id;
      }
      $this->params->set('product_id',$product_id);
      echo hikashop_getLayout('vote', 'listing', $this->params, $js);
      ?>
  </div>
  <div id="hikashop_product_vote_form" class="hikashop_product_vote_form">
      <?php
      $js = '';
      if(isset($this->element->main)){
        $product_id = $this->element->main->product_id;
      }else{
        $product_id = $this->element->product_id;
      }
      $this->params->set('product_id',$product_id);
      echo hikashop_getLayout('vote', 'form', $this->params, $js);
    }
    ?>
  </div>
  <input type="hidden" name="add" value="1"/>
  <input type="hidden" name="ctrl" value="product"/>
  <input type="hidden" name="task" value="show"/>
  <input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url)));?>"/>
</form>
<?php 
  }
} ?>
<?php $contact = $this->config->get('product_contact',0); ?>
<?php
  if(empty($this->element->variants)){
    if(hikashop_level(1) && !empty($this->element->options)){
      $priceUsed = 0;
      if(!empty($this->row->prices)){
        foreach($this->row->prices as $price){
          if(isset($price->price_min_quantity) && empty($this->cart_product_price)){
            if($price->price_min_quantity<=1){
              if($this->params->get('price_with_tax')){
                $priceUsed = $price->price_value_with_tax;
              } else {
                $priceUsed = $price->price_value;
              }
            }
          }
        }
      }
      echo '
      <input type="hidden" name="hikashop_price_product" value="'.$this->row->product_id.'" />
      <input type="hidden" id="hikashop_price_product_'.$this->row->product_id.'" value="'.$priceUsed.'" />
      <input type="hidden" id="hikashop_price_product_with_options_'.$this->row->product_id.'" value="'.$priceUsed.'" />';
    }
  } else {
    $perfs = $this->config->get('variant_increase_perf',1);
    if($perfs && !empty($this->element->main)){
      $required_fields = array();

      foreach (get_object_vars($this->element->main) as $name=>$value) {
        if(!is_array($name)&&!is_object($name)){
          $required = false;

          foreach ($this->element->variants as $variant) {
            if(!empty($variant->$name) && (!is_numeric($variant->$name) || $variant->$name>0)){
              $required = true;
              break;
            }
          }
          if($required){
            foreach ($this->element->variants as $k=>$variant) {
              if(empty($variant->$name) || (is_numeric($variant->$name) && $variant->$name==0.0)){
                if($name=='product_quantity' && $variant->$name==0){
                  continue;
                }
                $this->element->variants[$k]->$name=$this->element->main->$name;
              }
            }
          }
        }
      }
    }
    if(!isset($this->element->main->images))$this->element->main->images=null;
    $main_images =& $this->element->main->images;

    foreach ($this->element->variants as $variant) {
      $this->row = & $variant;
      $variant_name = array ();
      if (!empty ($variant->characteristics)) {
        foreach ($variant->characteristics as $k => $ch) {
          $variant_name[] = $ch->characteristic_id;
        }
      }
      $this->element->images =& $main_images;
      if (!empty ($variant->images)) {
          $this->element->images =& $variant->images;
      }

      $variant_name = implode('_', $variant_name);
      $this->variant_name = '_'.$variant_name;
      $this->setLayout('show_block_img');
      echo $this->loadTemplate();

      if(!empty($variant->product_name)){ ?>
      <div id="hikashop_product_name_<?php echo $variant_name;?>" style="display:none;">
        <?php echo $variant->product_name;?>
      </div>
      <?php }
      if ($this->config->get('show_code') &&!empty($variant->product_code)){ ?>
      <div id="hikashop_product_code_<?php echo $variant_name;?>" style="display:none;">
        <?php echo $variant->product_code;?>
      </div>
      <?php } ?>
      <div id="hikashop_product_price_<?php echo $variant_name;?>" style="display:none;">
        <?php
        if($this->params->get('show_price','-1')=='-1'){
          $config =& hikashop_config();
          $this->params->set('show_price',$config->get('show_price'));
        }
        if ($this->params->get('show_price')) {
          $this->setLayout('listing_price');
          echo $this->loadTemplate();
        }
?>
      </div>
      <?php
      if(hikashop_level(1) && !empty($this->element->options)){
        $priceUsed = 0;
        if(!empty($this->row->prices)){
          foreach($this->row->prices as $price){
            if(isset($price->price_min_quantity) && empty($this->cart_product_price)){
              if($price->price_min_quantity<=1){
                if($this->params->get('price_with_tax')){
                  $priceUsed = $price->price_value_with_tax;
                }else{
                  $priceUsed = $price->price_value;
                }

              }
            }
          }
        }
        echo '
        <input type="hidden" name="hikashop_price_product" value="'.$this->row->product_id.'" />
        <input type="hidden" id="hikashop_price_product_'.$this->row->product_id.'" value="'.$priceUsed.'" />
        <input type="hidden" id="hikashop_price_product_with_options_'.$this->row->product_id.'" value="'.$priceUsed.'" />';
      }
      ?>
      <div id="hikashop_product_quantity_<?php echo $variant_name;?>" style="display:none;">
        <?php

        $this->row = & $variant;
        if(empty($this->formName)) {
          $this->formName = ',0';
          if (!$this->config->get('ajax_add_to_cart', 1)) {
            $this->formName = ',\'hikashop_product_form\'';
          }
        }
        $this->ajax = 'if(hikashopCheckChangeForm(\'item\',\'hikashop_product_form\')){ return hikashopModifyQuantity(\'' . $this->row->product_id . '\',field,1' . $this->formName . ',\'cart\'); } else { return false; }';
        $this->setLayout('quantity');
        echo $this->loadTemplate();
?>
      </div>
      <div id="hikashop_product_contact_<?php echo $variant_name;?>" style="display:none;">
      <?php

        if (hikashop_level(1) && ($contact == 2 || ($contact == 1 && !empty ($this->element->main->product_contact)))) {
          echo $this->cart->displayButton(JText :: _('CONTACT_US_FOR_INFO'), 'contact_us', @ $this->params, hikashop_completeLink('product&task=contact&cid=' . $variant->product_id), 'window.location=\'' . hikashop_completeLink('product&task=contact&cid=' . $variant->product_id) . '\';return false;');
        }
?>
      </div>
      <?php if(!empty($variant->product_description)){ ?>
      <div id="hikashop_product_description_<?php echo $variant_name;?>" style="display:none;">
        <?php echo JHTML::_('content.prepare',preg_replace('#<hr *id="system-readmore" */>#i','',$variant->product_description));?>
      </div>
      <?php
      }
      if ($this->config->get('weight_display', 0)) {

        if(!empty($variant->product_weight) && bccomp($variant->product_weight,0,3)){ ?>
        <div id="hikashop_product_weight_<?php echo $variant_name;?>" style="display:none;">
          <?php echo JText::_('PRODUCT_WEIGHT').': '.rtrim(rtrim($variant->product_weight,'0'),',.').' '.JText::_($variant->product_weight_unit); ?><br />
        </div>
        <?php
        }
      }
      if ($this->config->get('dimensions_display', 0)) {

        if (!empty ($variant->product_width) && bccomp($variant->product_width, 0, 3)) {
?>
        <div id="hikashop_product_width_<?php echo $variant_name;?>" style="display:none;">
          <?php echo JText::_('PRODUCT_WIDTH').': '.rtrim(rtrim($variant->product_width,'0'),',.').' '.JText::_($variant->product_dimension_unit); ?><br />
        </div>
        <?php } ?>
        <?php if(!empty($variant->product_length) && bccomp($variant->product_length,0,3)){ ?>
        <div id="hikashop_product_length_<?php echo $variant_name;?>" style="display:none;">
          <?php echo JText::_('PRODUCT_LENGTH').': '.rtrim(rtrim($variant->product_length,'0'),',.').' '.JText::_($variant->product_dimension_unit); ?><br />
        </div>
        <?php } ?>
        <?php if(!empty($variant->product_height) && bccomp($variant->product_height,0,3)){ ?>
        <div id="hikashop_product_height_<?php echo $variant_name;?>" style="display:none;">
          <?php echo JText::_('PRODUCT_HEIGHT').': '.rtrim(rtrim($variant->product_height,'0'),',.').' '.JText::_($variant->product_dimension_unit); ?><br />
        </div>
        <?php

        }
      }
      if(!empty($variant->product_url)){ ?>
      <span id="hikashop_product_url_<?php echo $variant_name;?>" style="display:none;">
        <?php
        if (!empty ($variant->product_url)) {
          echo JText :: sprintf('MANUFACTURER_URL', '<a href="' . $variant->product_url . '" target="_blank">' . $variant->product_url . '</a>');
        } ?>
      </span>
      <?php } ?>
      <span id="hikashop_product_id_<?php echo $variant_name;?>">
        <input type="hidden" name="product_id" value="<?php echo $variant->product_id; ?>" />
      </span>
      <?php if(!empty($this->fields)){?>
      <div id="hikashop_product_custom_info_<?php echo $variant_name;?>" style="display:none;">
        <h4><?php echo JText::_('SPECIFICATIONS');?></h4>
        <table width="100%">
        <?php

      $this->fieldsClass->prefix = '';
      foreach ($this->fields as $fieldName => $oneExtraField) {
        if(empty($variant->$fieldName) && !empty($this->element->main->$fieldName)){
          $variant->$fieldName = $this->element->main->$fieldName;
        }
        if (!empty ($variant->$fieldName)) {
?>
          <tr class="hikashop_product_custom_<?php echo $oneExtraField->field_namekey;?>_line">
            <td class="key">
              <span id="hikashop_product_custom_name_<?php echo $oneExtraField->field_id;?>_<?php echo $variant_name;?>" class="hikashop_product_custom_name">
                <?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
              </span>
            </td>
            <td>
              <span id="hikashop_product_custom_value_<?php echo $oneExtraField->field_id;?>_<?php echo $variant_name;?>" class="hikashop_product_custom_value">
                <?php echo $this->fieldsClass->show($oneExtraField,$variant->$fieldName); ?>
              </span>
            </td>
          </tr>
        <?php

        }
      }
?>
        </table>
      </div>
    <?php

    }
    if (!empty ($variant->files)) {
      $skip = true;
      foreach ($variant->files as $file) {
        if ($file->file_free_download)
          $skip = false;
      }
      if (!$skip) {
?>
        <div id="hikashop_product_files_<?php echo $variant_name;?>" style="display:none;">
          <fieldset class="hikashop_product_files_fieldset">
            <?php

        $html = array ();
        echo '<legend>' . JText :: _('DOWNLOADS') . '</legend>';
        foreach ($variant->files as $file) {
          if (empty ($file->file_name)) {
            $file->file_name = $file->file_path;
          }
          $fileHtml = '';
          if (!empty ($file->file_free_download)) {
            $fileHtml = '<a class="hikashop_product_file_link" href="' . hikashop_completeLink('product&task=download&file_id=' . $file->file_id) . '">' . $file->file_name . '</a><br/>';
          }
          $html[] = $fileHtml;
        }
        echo implode('<br/>', $html);
?>
          </fieldset>
        </div>
    <?php

      }
    }
  }
}
$this->params->set('show_price_weight', 0);
?>
  <div class="hikashop_submodules" id="hikashop_submodules" style="clear:both">
    <?php

if (!empty ($this->modules) && is_array($this->modules)) {
  jimport('joomla.application.module.helper');
  foreach ($this->modules as $module) {
    echo JModuleHelper :: renderModule($module);
  }
}
?>
  </div>
  <div class="hikashop_external_comments" id="hikashop_external_comments" style="clear:both">
  <?php

$config = & hikashop_config();
if ($config->get('comments_feature') == 'jcomments') {
  $comments = HIKASHOP_ROOT . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
  if (file_exists($comments)) {
    require_once ($comments);
    if (hikashop_getCID('product_id')!=$this->element->product_id && isset ($this->element->main->product_name)){
      $product_id = $this->element->main->product_id;
      $product_name = $this->element->main->product_name;
    }else{
      $product_id = $this->element->product_id;
      $product_name = $this->element->product_name;
    }
    echo JComments::showComments($product_id, 'com_hikashop', $product_name);
  }
}
elseif ($config->get('comments_feature') == 'jomcomment') {
  $comments = HIKASHOP_ROOT . 'plugins' . DS . 'content' . DS . 'jom_comment_bot.php';
  if (file_exists($comments)) {
    require_once ($comments);
    if (hikashop_getCID('product_id')!=$this->element->product_id && isset ($this->element->main->product_name))
      $product_id = $this->element->main->product_id;
    else
      $product_id = $this->element->product_id;
    echo jomcomment($product_id, 'com_hikashop');
  }
}
?>
  </div><?php

}
?>
</div>

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #96642

At the top of this view, can you add the code: var_dump($this->element->product_canonical); to see if something is returned in this var ?
Or give us a backend access ?

Please Log in or Create an account to join the conversation.

  • Posts: 84
  • Thank you received: 0
11 years 7 months ago #96657

Hello, it return

string(0) ""

but in the product I had insert the canonical url

Thank you

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #96693

Thanks to check in your database if you have a value for the field "product_canonical" in the table "#__hikashop_product".

Can you try with: var_dump($this->element->main->product_canonical); to see if there is a result ?

Please Log in or Create an account to join the conversation.

  • Posts: 84
  • Thank you received: 0
11 years 7 months ago #96694

Ok, so this is what I see

string(49) "/abbigliamento-street/uomo/tshirts/secret-society"

and this is the screenshoot of the database




Thank you

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 84
  • Thank you received: 0
11 years 7 months ago #96695

I add this code in the beginning of the view and now I have the canonical link.
Thank you so much for your help!

if(isset($this->element->main->product_canonical) && !empty($this->element->main->product_canonical)){
 
  $parsedCanonical = parse_url($this->element->main->product_canonical);
  $parsedCurrent = parse_url(JURI::base());
 
  if(!isset($parsedCanonical['query']))
    $endUrl = $parsedCanonical['path'];
  else
    $endUrl = $parsedCanonical['path'].'?'.$parsedCanonical['query'];
 
  $canonicalUrl = $parsedCurrent['scheme'].'://'.$parsedCurrent['host'].$endUrl;
 
  $doc =& JFactory::getDocument();
  $doc->addCustomTag( '<link rel="canonical" href="'.$canonicalUrl.'" />' );
}

Please Log in or Create an account to join the conversation.

  • Posts: 3
  • Thank you received: 0
11 years 5 months ago #107985

I'm having the same problem with the canonical url not showing up properly. The canonical url is written as (and is written in the canonical url field)
www.bahoma.com/250-gift-certificate.html

However, the canonical url does not carry over to other instances if you go to the product through a different menu like this one:
www.bahoma.com/bahoma/product/show/323-2...ift-certificate.html

I am running sh404sef and I have changed the show display view.

Thanks for your help.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 5 months ago #108042

Hi,

Have you the latest version of Hikashop ? 2.1.3 ?

Can you give us a screenshot of your product page configuration ?

Please Log in or Create an account to join the conversation.

  • Posts: 3
  • Thank you received: 0
11 years 5 months ago #108056

Hi. Thank you for your reply. I have installed the latest version (2.1.3) and have also tried adding var_dump($this->element->main->product_canonical); and received the correct value.
Thanks again for your help.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 5 months ago #108059

Had you edited the view "product / show_default" ?
Can you check if you have the code:

if(isset($this->element->main->product_canonical) && !empty($this->element->main->product_canonical)){
 
  $parsedCanonical = parse_url($this->element->main->product_canonical);
  $parsedCurrent = parse_url(JURI::base());
 
  if(!isset($parsedCanonical['query']))
    $endUrl = $parsedCanonical['path'];
  else
    $endUrl = $parsedCanonical['path'].'?'.$parsedCanonical['query'];
 
  $canonicalUrl = $parsedCurrent['scheme'].'://'.$parsedCurrent['host'].$endUrl;
 
  $doc =& JFactory::getDocument();
  $doc->addCustomTag( '<link rel="canonical" href="'.$canonicalUrl.'" />' );
}

The following user(s) said Thank You: Catalyst

Please Log in or Create an account to join the conversation.

  • Posts: 3
  • Thank you received: 0
11 years 5 months ago #108063

Thank you for that it did the trick, but now I have two canonical tags on the page.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 5 months ago #108091

Yes I saw that, I think that you have another component/extension which is adding a canonical url too, but to a different domain..

Please Log in or Create an account to join the conversation.

Time to create page: 0.129 seconds
Powered by Kunena Forum