Ján Ambroz Ján Ambroz - 11 days ago 8
PHP Question

How to add link Sitemap in head in Prestashop

In PrestShop, I have 5 languages, so I have also 5 sitemaps like this:

1_de_0_sitemap.xml
1_en_0_sitemap.xml
1_lv_0_sitemap.xml,
etc.


How I can add link for sitemap to
<head>
for current front-end language?

It is PrestaShop 1.5.

The right way is doing it in .tpl or in some Controller?

Answer

You could do it in header.tpl, but I recommend you that used hookHeader insted. Something like this:

public function hookHeader($params)
{
    $sitemap_file = '1_' . $this->context->language->iso_code . '_0_sitemap.xml';
    //could work with echo too
    return 'your link here' . $sitemap_file;
}

Good luck