The site I'm working on is a webshop type of site, and it can have any amount of products in it's database which are all categorized somehow and their categories can change, so based on a product's category they all have a long url so it's something like: example.com/category/category-name/product-name/p/id

The site is also set up in a way that example.com/p/id, would automatically 301 redirect to the full URL.

The problem with the long URLs is that I have to query the category for each product when generating the sitemap, and doing this with short links would be a way faster process because those only need product IDs.

When generating a sitemap, would it be ok to use the short links of a product instead of the long ones and would it affect SEO at all?

  • You shouldn't be using sitemaps to link to a page. Sitemaps are used to discover paths that are difficult for a search engine to discover on its own.
    – Rob
    Commented Nov 5, 2021 at 9:49
  • Most sources I find on sitemaps say that all pages should be included, so that search engines can crawl them efficiently. But there is a lot of conflicting information as well which kind of confuses me. Commented Nov 5, 2021 at 10:16
  • That's not true. If there is a link to a page, search engines will find the page on their own. My personal web site has no sitemap at all and Google found everything.
    – Rob
    Commented Nov 5, 2021 at 10:32
  • Yes for a small site that's true, but this site has over a million of products, so building a sitemap will for sure help it get indexed the most efficient way. Commented Nov 5, 2021 at 10:38
  • If you have links to the products then, no, you gain nothing with a sitemap and only waste your time doing what search engines do for themselves.
    – Rob
    Commented Nov 5, 2021 at 11:03

1 Answer 1


Your sitemap should not contain redirects. Just pick the URL that you want and don't try and get so many keywords into it with categories. Pick the URL structure you want and just use that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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