为什么 Google Search Console 不喜欢我的 C# ASP.NET Core MVC 路由?

问题描述 投票:0回答:1

我刚刚将 C# ASP.NET Core 8.0 MVC Web 应用程序部署到 Azure。

我有一个

Sitemap.xml
文件,您可以在这里看到:

<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>

我向 Google Search Console 提交了我的

Sitemap.xml
网址,以开始获取网站索引,却收到以下错误列表,其中 Google 表示他们不喜欢“/”或“关于/指南”等网址。

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

有什么想法吗?或者我应该做什么?

非常感谢您的帮助,谢谢。

asp.net-core asp.net-core-mvc sitemap google-search-console
1个回答
0
投票

您应该将 XML 站点地图修改为如下所示:

<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>
    元素应包含完全限定的 URL(带有
    https://
    和域名)
  • Index
    不应该永远出现在您的网址中。索引文档为目录提供动力。它们应该在 URL 中隐藏,仅在 Web 服务器后端使用。
  • Google 会忽略
    lastmod
    changefreq
    priority
    ,因此您应该忽略它们。特别是如果您没有准确设置它们。
© www.soinside.com 2019 - 2024. All rights reserved.