Open MikaelPorttila opened 4 years ago
It's not supported out of the box but you can try to override ISitemapRepository.GetSitemapData
. When the /sitemap.xml is requested the repository is called to get SitemapData
by request URL. See GetaSitemapController
.
I have the exact same issue. Is there a another way to find the generated sitemap? Now we are dependent on proper DNS names that will not be the case for most cloud based hosting. It looks like that the request host
header is matched to the sitemap config.
Here is how I solved it recently.
Either create a decorator (decorator pattern) or just override GetSitemapData as mentioned above (new class that inherit from SitemapRepository). I chose decorator cause it is easier to unit test. The idea is to get the sitemap from the primary host for that language in hostdefinitions. It is very important to only generate sitemaps for the primary url and the primary url should be the one that is exposed to the public.
Created a gist: https://gist.github.com/palle-mertz/658427dc968d1119a2d050da5ff9b687
Thanks @palle-mertz! Works like charm.
Hi, I'm hosting an EPiServer app with SEO.SiteMaps on a Azure App Service with a hostname binding to "we.mypage.page"
In front of the app service I have an Azure Frontdoor which will redirect all request from mypage.page to the app service we.mypage.page.
If I run the sitemap EPi-job now, it will create a sitemap for we.mypage.page and if I try to request mypage.page/sitemap.xml I will get a 404 response.
Can I somehow configure SEO.Sitemaps to map the mypage.page/sitemap.xml and generate a sitemap.xml which points at mypage.page even if the instance of EPiServer has a binding to the subdomain we.mypage.page?
Flow and response I'm looking for: | Az Frontdoor: mypage.page/sitemap.xml | ----> | App Service with EPiServer: we.mypage.page/sitemap.xml | ----> sitemap.xml containing url to "mypage.page/sitemap.xml"