public void TestCustomSitemap() { using var runner = TestRunner.Run(GetTest(BotInstructions.Default().Sitemap("sitemap.xml"))); var result = GetRobots(runner); Assert.Contains("Sitemap: http://localhost/sitemap.xml", result); }
public void TestAbsoluteSitemap() { using var runner = TestRunner.Run(GetTest(BotInstructions.Default().Sitemap("http://my/sitemap.xml"))); var result = GetRobots(runner); Assert.Contains("Sitemap: http://my/sitemap.xml", result); }
public void TestDefault() { using var runner = TestRunner.Run(GetTest(BotInstructions.Default())); var result = GetRobots(runner); Assert.Contains("User-agent: *", result); Assert.Contains("Allow: /", result); Assert.DoesNotContain("Sitemap", result); }
public WebsiteRouter(IHandler parent, IHandlerBuilder content, IEnumerable <IConcernBuilder> concerns, IHandlerBuilder scripts, IHandlerBuilder styles, IResourceProvider?favicon, IMenuProvider?menu, ITheme theme) { Parent = parent; var layout = Layout.Create() .Add("scripts", scripts) .Add("styles", styles) .Add("sitemap.xml", Sitemap.Create()) .Add("robots.txt", BotInstructions.Default().Sitemap()) .Fallback(content); foreach (var concern in concerns) { layout.Add(concern); } if (favicon != null) { layout.Add("favicon.ico", Download.From(favicon).Type(ContentType.ImageIcon)); } if (theme.Resources != null) { layout.Add("resources", theme.Resources); } Handler = layout.Build(this); Theme = theme; Menu = menu ?? Websites.Menu.Create((r, _) => GetContent(r)).Build(); var scriptRouter = (ScriptRouter)scripts.Build(this); var styleRouter = (StyleRouter)styles.Build(this); Renderer = new WebsiteRenderer(Theme, Menu, scriptRouter, styleRouter); }