Hook actionModifyFrontendSitemap

Informations

Add or remove links on sitemap page This hook allows to modify links on sitemap page of your shop. Useful to improve indexation of your modules.
Hook actionModifyFrontendSitemap
Locations
FO
Type action
Origin core
Aliases
Description This hook allows to modify links on sitemap page of your shop. Useful to improve indexation of your modules.

Located in

Origin File
core controllers/front/SitemapController.php

Call of the Hook in the origin file

Hook::exec(
    'actionModifyFrontendSitemap',
    ['urls' => &$sitemapUrls]
);

Example implementation

public function hookActionModifyFrontendSitemap($params)
{
    $customUrls = [
        [
            'id' => 'custom-url-1',
            'label' => 'Custom URL',
            'url' => 'https://prestashop-project.org',
        ]
    ];

    $params['urls']['pages']['links'] = array_merge($params['urls']['pages']['links'], $customUrls); // add custom urls to pages group
    unset($params['urls']['categories']); // hide categories
}