John posted via Twitter today,
“For a temporary state, it’s fine to have redirects in the sitemap file. Long term, you want the URLs listed there as canonical.”
Therefore, the XML sitemaps should ideally include URLs that function correctly and do not redirect users to 404 or 302 or 301 redirect to other websites. However, you may have them in place in the short term, but do not ignore them, and be sure that you remove them from your sitemap later on.
John later added,
“The reasons are different in the case of redirects. The sitemap is helpful in the process of recrawling (finding any redirects). For stable URLs, the sitemap assists with canonicalization.
He further said,
“Temporary is when the move is mostly complete, and you want to focus on the new stable state. Practically, probably after 1-3 months. I suspect the effect is minimal nowadays, but optimizers want to optimize.”
Here are the tweets:
You can follow detailed forum discussion at Twitter.
John Mueller's suggetion to keep old redirected URLs in sitemaps files temporarily is wise. For your information, Google redirect signals takes a year to stick with destination URL. John Mueller of Google said that three months for Google redirect signals to be in place is not enough, and we need to keep it up for a year. In conclusion, Google redirects are useful and crucial. You need to be careful while using 301 redirects.