Skip to content

Commit

Permalink
Merge branch '8094-boilerplate-project-templates-sitemapxml-is-missin…
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi committed Jul 22, 2024
2 parents 4e445a6 + 28cb5bf commit b4d416c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
User-agent: *
Disallow:
Sitemap: https://use-your-server-url-here.com/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ self.serverHandledUrls = [
/\/healthz/,
/\/swagger/,
/\/signin-/,
/\/.well-known/
/\/.well-known/,
/\/sitemap.xml/,
];

self.defaultUrl = "/";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ private static void UseSiteMap(this WebApplication app)
.ToList()!;

urls = CultureInfoManager.MultilingualEnabled ?
CultureInfoManager.SupportedCultures.SelectMany(sc => urls.Select(url => $"{url}?culture={sc.Culture.Name}")).ToList() :
urls.Union(CultureInfoManager.SupportedCultures.SelectMany(sc => urls.Select(url => $"{url}?culture={sc.Culture.Name}"))).ToList() :
urls;

const string siteMapHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<urlset\r\n xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\"\r\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9\r\n http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\">";

app.MapGet("/sitemap.XML", async context =>
app.MapGet("/sitemap.xml", async context =>
{
if (siteMap is null)
{
Expand Down

0 comments on commit b4d416c

Please sign in to comment.