2

On a project, there is two different URL, that has a lot of the same content. As an example, let's say:

https://first-url.example/text/my-post
https://second-url.example/text/my-post

The https://second-url.example/text/my-post page has defined <link rel="canonical" href="https://first-url.example/text/my-post" /> to suggest to Google that first-url.example URLs should be preferred in Google search results etc.

The problem

What should I do or how should I think about what to put in sitemap.xml on the second-url.example site? Should it be the same as the canonical URL, or should it just point to it's own URLs? How should I think about this?

🙏🏻

1
  • 1
    Since first-url.example/text/my-post is the URL that you want to get ranked, why not omit second-url.example/text/my-post in the sitemap (of second-url.example domain). Moreover, a sitemap is good but not necessary for a URL to be found by Google. – Kannan Jun 16 at 15:40
1

You want to omit URLs from your sitemap that canonicalize to another domain. Your sitemap is for URLs on your own site that you want to have indexed by search engines. https://second-url.example/text/my-post shouldn't be in the sitemap because:

  • You don't want to have it indexed, you want to have the canonical on your other domain indexed, so you shouldn't include the URL that isn't the canonical. Google says this.
  • You don't want to include https://first-url.example/text/my-post in your 'second-url.example' sitemap because the domain doesn't match. Sitemaps are only for URLs on your own domain.

When you create the sitemap for first-url.example you want to include https://first-url.example/text/my-post. Only the sitemap for that site should include this page.

1

According to sitemaps.org, all the URLs in a sitemap should be from the same host.

Also, all URLs in a Sitemap must be from a single host, such as www.example.com or store.example.com.

source: https://www.sitemaps.org/protocol.html

Hence there is no question of including the canonical URL in the sitemap of the second domain. So you can only add the original URL https://second-url.example/text/my-post.

UPDATE:

Based on Stephen Ostermiller's answer (which should be the accepted answer), it is better to omit the URL in the sitemap of the second domain.

1
  • Great! Thanks. So my choice are then, either add the original URL, or just omit the entire sitemap.xml. :) – eivindml Jun 17 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.