TransWikia.com

Magento 1.9 How can i add the category name and category id in the canonical url

Magento Asked by user12398926 on November 5, 2021

In magento 1.9 I am trying to get the canonical URL for the category
In the view source, I am getting as

<link rel="canonical" href="https://domain/categoy" />

I wanted to add the category id also in it can I do that?

can anyone help me how I can add the category Id to the canonical

currently, I am getting as

<link rel="canonical" href="https://domainname/caregotyname" />

i also wanted to add the categoty id i don’t the correct syntax but something like this is possible

<link rel="canonical" id='categoty_id' />

I am not sure but something like this

One Answer

With reference to this link.

Please follow the steps.

– Go to the category page you want to change canonical URL in Magento Admin

– Click the tab “Custom Design”

– In the Custom Layout Update textbox, paste this:

<reference name="head">
    <action method="removeItem" block="head">
        <item>link_rel</item>
        <name>http://loca.lho.st/old-canonical-url</name>
    </action>
    <action method="addLinkRel" translate="title">
        <rel>canonical</rel>
        <href>http://loca.lho.st/new-canonical-url</href>
    </action>
</reference>

Change the URL with your URL and it will be working.

Happy Coding. :)

Answered by Mayur Sisodiya on November 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP