public Task <IEnumerable <Sitemap> > InvokeAsync() { var location = _locationHelper.GetSitemapUrl("example-path"); var myMock = new Sitemap(location) { ChangeFrequency = ChangeFrequency.Monthly, Priority = SitemapPriority.AboveNormal, }; return(Task.FromResult(Enumerable.Repeat(myMock, 3))); }
public RobotsMiddleware(SitemapSettings settings, ILocationHelper locationHelper) { var sw = new Utf8StringWriter(); foreach (var item in settings.GetUserAgents()) { sw.Write("User-agent: {0}\n", item.UserAgent); foreach (var allow in item.Allows) { sw.Write("Allow: {0}\n", allow); } foreach (var disallow in item.Disallows) { sw.Write("Disallow: {0}\n", disallow); } sw.WriteLine(); } sw.Write("Sitemap: " + locationHelper.GetSitemapUrl(settings.SitemapPath)); Content = sw.ToString(); }