Search code examples
asp.net-coreasp.net-core-mvcsitemapgoogle-search-console

Why does Google Search Console dislike my C# ASP.NET Core MVC routes?


I've just deployed a C# ASP.NET Core 8.0 MVC web app to Azure.

I have a Sitemap.xml file, as you can see here:

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>Home/Index</loc>
<lastmod>2024-01-30</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>About/Index</loc>
<lastmod>2024-01-30</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>About/Guide</loc>
<lastmod>2024-01-30</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>/About/FAQs</loc>
<lastmod>2024-01-30</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>/About/Roadmap</loc>
<lastmod>2024-01-30</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>/About/Terms</loc>
<lastmod>2024-01-30</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>/About/Privacy</loc>
<lastmod>2024-01-30</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>/About/GDPR</loc>
<lastmod>2024-01-30</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>/Support/ContactUs</loc>
<lastmod>2024-01-30</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>/Support/Troubleshooting</loc>
<lastmod>2024-01-30</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>/Blog</loc>
<lastmod>2024-01-30</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>/rss</loc>
<lastmod>2024-01-30</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>/Account/SignUp</loc>
<lastmod>2024-01-30</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>/Account/LogIn</loc>
<lastmod>2024-01-30</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>/Account/ForgotPassword</loc>
<lastmod>2024-01-30</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>/</loc>
<lastmod>2024-01-30</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>
/blog/Real-time-UK-FIRE-Calculator-Release-Version-1
</loc>
<lastmod>2024-01-30</lastmod>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
</urlset>

I submitted my Sitemap.xml URL to Google Search Console, to begin getting the website index, only to receive the following list of errors, whereby Google states that they dislike urls such as "/", or "About/Guide".

Sitemap can be read, but has errors
Invalid URL
17 instances
This is not a valid URL. Please correct it and resubmit.
Examples
URL:
Home/Index
Line 3
Parent tag:
url
Tag:
loc
URL:
About/Index
Line 9
Parent tag:
url
Tag:
loc
URL:
About/Guide
Line 15
Parent tag:
url
Tag:
loc

Any ideas why this is? Or what I should do?

Help would be greatly appreciated, thank you.


Solution

  • You should modify your XML sitemap to look like this:

    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <url><loc>https://example.com/Home/</loc></url>
    <url><loc>https://example.com/About/</loc></url>
    <url><loc>https://example.com/About/Guide</loc></url>
    ...
    </urlset>
    
    
    • <loc> elements should contain fully qualified URLs (with https:// and the domain name)
    • Index should never appear in your URLs. Index documents power the directory. They are meant to be hidden from the URL and only used in the web server back end.
    • Google ignores lastmod, changefreq and priority so you should just omit them. Especially if you are not setting them accurately.