0
0

Add sitemap

This commit is contained in:
Sergey Chebotar 2023-06-16 07:03:56 +03:00
parent ecf537fdca
commit f6f75d364f
2 changed files with 23 additions and 1 deletions

View File

@ -6,4 +6,5 @@
User-agent: * User-agent: *
Disallow: /freedom Disallow: /freedom
Disallow: /account Disallow: /account
Disallow: /Account Disallow: /Account
sitemap: https://mydarlingunderwear.ru/sitemap.xml

21
Pages/Sitemap.xml.cshtml Normal file
View File

@ -0,0 +1,21 @@
@page "/sitemap.xml"
@using Microsoft.AspNetCore.Http
@{
var pages = new List<dynamic>
{
new {Url = "https://mydarlingunderwear.ru/", LastUpdated = DateTime.Today}
};
Layout = null;
Response.ContentType = "text/xml";
await Response.WriteAsync("<?xml version='1.0' encoding='UTF-8' ?>");
}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@foreach (var p in pages)
{
<url>
<loc>@p.Url</loc>
<lastmod>@p.LastUpdated.ToString("yyyy-MM-dd")</lastmod>
</url>
}
</urlset>