I can't find info about dynamic URL in sitemap file.
For example: I have such URL on my project
https://example.com/cards/(card id)
https://example.com/cards/1234-1234-1234-1234
https://example.com/cards/5678-5678-5678-5678
https://example.com/cards/9012-9012-9012-9012
etc.
Can I write in a sitemap URL like this and Google will be able to crawl and index all the dynamic URLs from it?
<url>
<loc>https://example/cards/:id</loc>
<lastmod>2023-02-22</lastmod>
<changefreq>always</changefreq>
<priority>1</priority>
</url>
The point of a sitemap is to tell Google about all the valid values for your dynamic URLs. You can't just put :id
as a placeholder in a sitemap <loc>
and expect Google to know how to deal with it. You have to list all the valid URLs with valid id parameters in your sitemap.
You should omit the <lastmod>
, <changefreq>
, and <priority>
fields from your sitemap. Google says it ignores them. They just end up bloating the sitemap.
Your XML sitemap should contain:
<url><loc>https://example.com/cards/1234-1234-1234-1234</loc></url>
<url><loc>https://example.com/cards/5678-5678-5678-5678</loc></url>
<url><loc>https://example.com/cards/9012-9012-9012-9012</loc></url>
Listing every URL in your XML sitemap like this will get Googlebot to come crawl each of them. It will give you stats in Google Search Console about how many of them get indexed. However, Google rarely indexes URLs just because it finds them in your XML sitemap. An XML sitemap is not sufficient for SEO. You must also link to each page from other pages so that Google can assign PageRank to the page. See The Sitemap Paradox