prestaconcept / PrestaSitemapBundle

A symfony bundle that provides tools to build a rich application sitemap. The main goals are : simple, no databases, various namespace (eg. google image), respect constraints etc.
MIT License
347 stars 100 forks source link

Namespace Issue in Sitemap #340

Closed BriceFab closed 3 months ago

BriceFab commented 3 months ago

Problem Description

After updating the PrestaConcept bundle from version 3.3 to 4.1 in our project, we have encountered an issue as reported by Google's Search Console. The error message from Google indicates that there is a problem with namespaces: "The namespace is not correctly indicated in your index file or your sitemap."

Despite reviewing the sitemap output, the issue is not immediately apparent, as everything seems correct at first glance. This problem has arisen post-update, and we were not encountering this issue in the previous version of the bundle.

Steps to Reproduce

  1. Update the PrestaConcept bundle from version 3.3 to 4.1.
  2. Generate the complex sitemap (with news, video, tags).
  3. Submit the sitemap to Google's Search Console.

Expected Behavior

The sitemap should be accepted by Google's Search Console without any namespace-related errors.

Actual Behavior

Google's Search Console reports an error regarding the namespaces, suggesting they are not correctly indicated in the sitemap or index file.

Additional Context

I would greatly appreciate any guidance or recommendations on how to resolve this namespace issue. Is there a known workaround or fix that could be applied to ensure compliance with Google's Search Console requirements? I can open a PR if someone has more information about what's the problem reported from Google.

The sitemap URL is: https://www.fitmetrics.ch/sitemaps/sitemap.xml and https://www.fitmetrics.ch/sitemaps/sitemap.exercise.xml image image

Environment

Thank you for your time and assistance, and for your continued efforts in developing and maintaining the PrestaConcept bundle. Your work is greatly appreciated by the community.

yann-eugone commented 3 months ago

Hello, So it was working with the bundle previous version?

I see you did your best at providing details, still it is not easy to understand what happen without the sitemap content. Can you add to this issue:

roderikmutsaers commented 3 months ago

Same error here.

Problem seems to be the 'xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"' line in src/Sitemap/Sitemapindex.php Google doesn't accept https over here. When changed to http the warning in Google Search Console is gone.

BriceFab commented 3 months ago

Same error here.

Problem seems to be the 'xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"' line in src/Sitemap/Sitemapindex.php Google doesn't accept https over here. When changed to http the warning in Google Search Console is gone.

It was changed on the last release: https://github.com/prestaconcept/PrestaSitemapBundle/compare/v4.0.0...v4.1.0 I'll try to re-generate my sitemap with version v4.0.0 and sent it again to google search console. I keep you inform

BriceFab commented 3 months ago

Same error here.

Problem seems to be the 'xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"' line in src/Sitemap/Sitemapindex.php Google doesn't accept https over here. When changed to http the warning in Google Search Console is gone.

I confirm the issue of https that is not allowed by Google: image

By fixing the release to: "presta/sitemap-bundle": "4.0", It's work. https://github.com/prestaconcept/PrestaSitemapBundle/compare/v4.0.0...v4.1.0

cc @yann-eugone

yann-eugone commented 3 months ago

So it's all related to this https://github.com/prestaconcept/PrestaSitemapBundle/pull/337

But I don't understand why Google is struggling with https here It seems that the http page is redirecting to the https page anyway

$ curl -sLD - http://www.sitemaps.org/schemas/sitemap/0.9

HTTP/1.1 301 Moved Permanently
Content-Length: 0
Date: Thu, 14 Mar 2024 13:38:03 GMT
Location: https://www.sitemaps.org/schemas/sitemap/0.9
nediam commented 3 months ago

Because its namespace identifier, not a URL ;) and namespace is with http://

yann-eugone commented 3 months ago

Here it is : https://github.com/prestaconcept/PrestaSitemapBundle/releases/tag/v4.1.1 Sorry for not spotting that during the review