Jump to content

Edit History

Tomi14

Tomi14

 

On 9/17/2023 at 3:15 PM, elisolution said:

I changed it in this way because It works better 👇:

{if $page.canonical}
  <link rel="canonical" href="{$page.canonical}">
{elseif $page.canonical = 'index'}
  <link rel="canonical" href="https://vidos-domofony.pl">
{/if}

 

 

 

With this, now I have 14 pages with Canonicalised errors.

Do you have any idea how to fix it?  Most of this pages are sites, from help category: https://vidos-domofony.pl/category/9-pomoc

With homepage your solutions works great

image.thumb.png.0e14819e3a6c00068c5b8fb42f61a4e7.png

  

On 8/28/2023 at 3:19 PM, LarsM said:

I had the same issue in PrestaShop 8.1.1 and made this solution:

In the file: /themes/XXXX/templates/_partials/head.tpl 

I changed this (lines 42-44):

  {if $page.canonical}
    <link rel="canonical" href="{$page.canonical}">
  {/if} 

To this:

  {if $page.canonical}
    <link rel="canonical" href="{$page.canonical}">
  {elseif $page.page_name == 'index'}
    <link rel="canonical" href="https://{$smarty.server.HTTP_HOST}/">
  {/if} 

In additon to elisolution's answer above, this also checks whether we are actually on the home page (not just whether the canonical was set or not).

I tested this solution a bit and as far as I can see, it works as expected. Otherwise, please let me know!

Thanks :)

PS: Remember to change "https" to "http" if your site isn't handling requests through the HTTPS protocol. You could fiddle with variables like $smarty.server.REQUEST_SCHEME or $smarty.server.HTTPS to check automatically, but it seemed like overkill to me, as I always use the HTTPS protocol on my websites these days.

 

But with this, I have only 7 Canonicals missing

image.thumb.png.f4a1fd39c0f540396ba6f84430bef576.png

 

Tomi14

Tomi14

On 11/2/2023 at 7:49 PM, Hart said:

to implement the canonical for multilanguage use this code:

 

  {if $page.canonical}
    <link rel="canonical" href="{$page.canonical}">
  {elseif $page.page_name == 'index'}
    <link rel="canonical" href="{$smarty.server.SCRIPT_URI}">
  {/if}

 

 

On 9/17/2023 at 3:15 PM, elisolution said:

I changed it in this way because It works better 👇:

{if $page.canonical}
  <link rel="canonical" href="{$page.canonical}">
{elseif $page.canonical = 'index'}
  <link rel="canonical" href="https://mysite.com">
{/if}

 

 

 

 

Now I have 14 pages with Canonicalised errors.

Do you have any idea how to fix it?  Most of this pages are sites, from help category: https://vidos-domofony.pl/category/9-pomoc

With homepage your solutions works great

 

image.thumb.png.0e14819e3a6c00068c5b8fb42f61a4e7.png

Tomi14

Tomi14

On 11/2/2023 at 7:49 PM, Hart said:

to implement the canonical for multilanguage use this code:

 

  {if $page.canonical}
    <link rel="canonical" href="{$page.canonical}">
  {elseif $page.page_name == 'index'}
    <link rel="canonical" href="{$smarty.server.SCRIPT_URI}">
  {/if}

 

 

On 9/17/2023 at 3:15 PM, elisolution said:

I changed it in this way because It works better 👇:

{if $page.canonical}
  <link rel="canonical" href="{$page.canonical}">
{elseif $page.canonical = 'index'}
  <link rel="canonical" href="https://mysite.com">
{/if}

 

 

 

 

Now I have 14 pages with Canonicalised errors.

Do you have any idea how to fix it? 

With homepage your solutions works great

 

image.thumb.png.0e14819e3a6c00068c5b8fb42f61a4e7.png

×
×
  • Create New...