sybrew/the-seo-framework

Sitemap should contain canonical URLs, not permalinks

Opened this issue · 0 comments

sybrew commented

From dracoteam's comments:

The sitemap currently outputs permalinks. These permalinks may not always be canonical. Typically, it's only different when a user enters a custom URL.

Google considers the URLs in the sitemap canonical. However, the canonical URL tag, which TSF forcefully outputs (almost) everywhere, will override this treatment.

The biggest hurdle with changing from permalinks to canonical URLs is the database lookups, which are perpendicular to the number of URLs in the sitemap (up to 50,000). Moreover, we need to validate all URLs for the scheme settings: If the URL matches the site's domain, the scheme will be forced.

To work around this, we could fetch all custom canonical URLs in a single query, but this adds complexity in validating the URLs.

Only when PHP gets multithreading should we consider this. In the meantime, we could provide an advanced toggle: "Use a more "correct" sitemap at the expense of system resources?"