0

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

1 Answer 1

0

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. :)

1
  • thanks i reffered it but i want something like this <link rel="canonical" href="domainname/caregotyname" /> <link rel="canonical" id='categoty_id' /> i am not sure but something like this Commented Jul 21, 2020 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.