Novactive / NovaeZSEOBundle

Novactive eZ Publish and Platform SEO Bundle
MIT License
25 stars 57 forks source link

Use consistent, fully-qualified URLs #39

Closed skrosoft closed 7 years ago

skrosoft commented 7 years ago

Hello,

Sitemap is giving us a relative path when it should give absolute path (ref: https://support.google.com/webmasters/answer/183668?hl=en)

It return:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <url>
        <loc>/Alianzas/Ingram-Micro-Chile</loc>
        <lastmod>2017-02-08T19:16:13+00:00</lastmod>
    </url>
</urlset>

When it should return:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <url>
        <loc>http://localhost:8000/Alianzas/Ingram-Micro-Chile</loc>
        <lastmod>2017-02-08T19:16:13+00:00</lastmod>
    </url>
</urlset>

In this file https://github.com/Novactive/NovaeZSEOBundle/blob/develop-ezplatform/Controller/SitemapController.php#L166

We should use:

$url = $this->generateUrl( $location, [ ], UrlGeneratorInterface::ABSOLUTE_URL );

Instead of

$url = $this->generateUrl( $location, [ ], true );

The same for the line https://github.com/Novactive/NovaeZSEOBundle/blob/develop-ezplatform/Controller/SitemapController.php#L190

I made a pull request.

Vincent

Plopix commented 7 years ago

Made an answer in the PR, I completely agree I am surprised as I as absolute URL on projects. But definitively a good fix, I just want to understand why it was working for us. (symfony version?)

Plopix commented 7 years ago

Thank you @skrosoft merged and tagged