From f6f75d364fba97a5160dd1232086a903ca9bbaf2 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Fri, 16 Jun 2023 07:03:56 +0300 Subject: [PATCH] Add sitemap --- Pages/Robots.txt.cshtml | 3 ++- Pages/Sitemap.xml.cshtml | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 Pages/Sitemap.xml.cshtml diff --git a/Pages/Robots.txt.cshtml b/Pages/Robots.txt.cshtml index 54c25f2..4c46b79 100644 --- a/Pages/Robots.txt.cshtml +++ b/Pages/Robots.txt.cshtml @@ -6,4 +6,5 @@ User-agent: * Disallow: /freedom Disallow: /account -Disallow: /Account \ No newline at end of file +Disallow: /Account +sitemap: https://mydarlingunderwear.ru/sitemap.xml \ No newline at end of file diff --git a/Pages/Sitemap.xml.cshtml b/Pages/Sitemap.xml.cshtml new file mode 100644 index 0000000..f686066 --- /dev/null +++ b/Pages/Sitemap.xml.cshtml @@ -0,0 +1,21 @@ +@page "/sitemap.xml" +@using Microsoft.AspNetCore.Http +@{ + var pages = new List + { + new {Url = "https://mydarlingunderwear.ru/", LastUpdated = DateTime.Today} + }; + Layout = null; + Response.ContentType = "text/xml"; + await Response.WriteAsync(""); +} + + + @foreach (var p in pages) + { + + @p.Url + @p.LastUpdated.ToString("yyyy-MM-dd") + + } + \ No newline at end of file