- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017
09:10 AM
09-07-2017
09:10 AM
I tried for products and it works fine but for categories I can't remove canonical but I can add a new one.
The problem is that in html code I find 2 different canonical urls.
I used this code in category design field:
<reference name="head"> <action method="removeItem" block="head"> <item>link_rel</item> <name>https://www.mysite.com/produttore/birra-menabrea</name> </action> <action method="addLinkRel" translate="title"> <rel>canonical</rel> <href>https://www.mysite.com/birra-menabrea.html</href> </action> </reference>
I get:
<link rel="canonical" href="https://www.mysite.com/produttore/birra-menabrea" /> <link rel="canonical" href="https://www.mysite.com/birra-menabrea.html" />
I tried also on a clean magento v1.9.3.4 installation and it doesn't work.
Solved! Go to Solution.
Labels:
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017
11:55 AM
09-07-2017
11:55 AM
I don't think it would have stopped it from working but you don't need the block attribute on the action.
It should be:
<reference name="head"> <action method="removeItem"> <type>link_rel</type> <name>https://www.lacompagniadelcavatappi.com/produttore/birra-menabrea</name> </action> </reference>
Somebody else on the internet (https://magento.stackexchange.com/a/124290/26) seemed to have to add a second remove line too:
<reference name="head"> <action method="removeItem"> <type>link_rel</type> <name>https://www.lacompagniadelcavatappi.com/produttore/birra-menabrea</name> </action> <action method="removeItem"> <type>link_rel</type> <name>https://www.lacompagniadelcavatappi.com/produttore/birra-menabrea?___SID=U</name> </action> </reference>
----
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution" as appropriate. Thanks!
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution" as appropriate. Thanks!
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2017
11:55 AM
09-07-2017
11:55 AM
I don't think it would have stopped it from working but you don't need the block attribute on the action.
It should be:
<reference name="head"> <action method="removeItem"> <type>link_rel</type> <name>https://www.lacompagniadelcavatappi.com/produttore/birra-menabrea</name> </action> </reference>
Somebody else on the internet (https://magento.stackexchange.com/a/124290/26) seemed to have to add a second remove line too:
<reference name="head"> <action method="removeItem"> <type>link_rel</type> <name>https://www.lacompagniadelcavatappi.com/produttore/birra-menabrea</name> </action> <action method="removeItem"> <type>link_rel</type> <name>https://www.lacompagniadelcavatappi.com/produttore/birra-menabrea?___SID=U</name> </action> </reference>
----
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution" as appropriate. Thanks!
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution" as appropriate. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2017
02:00 AM
09-15-2017
02:00 AM
Re: Remove canonical url from category
Adding __SID at the end of the url removes the canonical from category page. You don't need to do this on a product page.
Many thanks for the solution.