wilr / silverstripe-googlesitemaps

Google Sitemaps module for the SilverStripe CMS
BSD 3-Clause "New" or "Revised" License
74 stars 95 forks source link

canIncludeInSitemap - Enforce single domain? #53

Open tractorcow opened 11 years ago

tractorcow commented 11 years ago

I am investigating multiple-domain based localisation for a single site, and have been following the google sitemap guide at https://support.google.com/webmasters/answer/75712?hl=en

This is not so much a problem as a critique of the method followed by GoogleSitemapExtension::canIncludeInSitemap(). This code seems to explicitly exclude items that may be visible under a different hostname.

Why is it necessary to limit to a single domain if the specification doesn't prohibit it?

wilr commented 11 years ago

The specification doesn't prohibit it but Google isn't such a fan of different URL's so the check was to prevent that as much as possible. https://support.google.com/webmasters/answer/35738?hl=en (URL Not Allowed).

tractorcow commented 11 years ago

Thanks @wilr for the prompt response.

It does seem a bit contradictory, but it seems from the documentation that this only becomes an issue if only a single domain is verified (www.example.com and not example.com), but it isn't an issue if two domains are each verified under the same account (www.example.com and www.example.co.uk).

So my next question is, can we raise this as an issue with the googlesitemap module? A potential solution would be to make the single-domain restriction configurable.

It could also be argued that alterCanIncludeInGoogleSitemap hook allows users to override this behaviour, but it's still abit awkward.

I feel a change in behaviour would be acceptable, but I don't feel strongly that it's urgent. Would you mind if I submit a PR with a suggested fix?

wilr commented 11 years ago

Acceptable to me. PR as always, welcome with open arms.