contao / core-bundle

[READ-ONLY] Contao Core Bundle
GNU Lesser General Public License v3.0
123 stars 58 forks source link

Adding sitemap path and filename to HTML head (fe_page) #1705

Closed pgerundt closed 4 years ago

pgerundt commented 4 years ago

It would be nice to add a variable $sitemap to the fe_page template containing the path a name of the sitemap file (if set):

<?php if($this->sitemap): ?>
    <link rel="sitemap" type="application/xml" title="Sitemap" href="<?= $this->sitemap; ?>" />
<?php endif; ?>

Only a few lines have to be added to PageRegular.php:

$rootPage = \Frontend::getRootPageFromUrl();
if(($rootPage) && ($rootPage->createSitemap) && ($rootPage->sitemapName)) {
    $objPageRegular->Template->sitemap = \Environment::get('url') . '/share/' . $rootPage->sitemapName . '.xml';
}

Anyone agrees?

fritzmg commented 4 years ago

@pgerundt issues should be created in the mono repository, not here.

Also this feature is moot in Contao 4.9, due to the automatic robots.txt generation :). No need to clutter the HTML mark-up with sitemap references.