Announcement

Collapse
No announcement yet.

CMS Page Canonical issue in my Magento Site

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • CMS Page Canonical issue in my Magento Site

    Hi,

    is there any way to place self canonical on CMS pages in Magneto?
    We have developed our site in Magneto dealing with industrial supplies for Industrial products. We are facing a serious issue on our site.
    We have placed canonical tag at home page https://www.indusuno.com/, but this is replicating on about us, contact us, privacy policies etc. on all CMS pages.

    Kindly check all pages and let me know if any one have solutions.

  • #2
    Hi,

    As per my understanding, you want to place page URL on CMS pages. For this you have to first identify the CMS page then you have to place some additional code. This code will be placed at the same place where your code for canonical is

    $isCanonical = Mage::app()->getRequest()->getRouteName();

    if($isCanonical == 'cms') {

    $currentUrl = Mage::helper('core/url')->getCurrentUrl();

    $url = Mage::getSingleton('core/url')->parseUrl($currentUrl);

    $path = $url->getPath();
    <link href="<?php echo $path ?>" rel="canonical" />

    } else {

    //Your Normal Code for canonical

    }

    If you want to put some specific canonical URL at any CMS page then you have to make some changes in that CMS page from the backend. To make that change go to

    CMS -> Pages -> Your_CMS_Page-> Design

    then inside Layout update XML put the following code

    <reference name="head">
    <action method="addLinkRel">
    <rel>canonical</rel>
    <href>http://www.YourUrlHere.com/</href>
    </action>
    </reference>

    Comment

    Working...
    X