예제 #1
0
        public void ProcessRequest(HttpContext context)
        {
            _context = context;

            var response = context.Response;

            response.ContentType     = "text/xml";
            response.ContentEncoding = Encoding.UTF8;

            using (var writer = new XmlTextWriter(response.Output))
            {
                // Add indents in order to test the XML minification
                writer.Formatting = Formatting.Indented;

                IList <SitemapItem> items = GetSitemapItems();

                XDocument sitemap = _sitemapService.GenerateXmlSiteMap(items);
                sitemap.WriteTo(writer);
            }
        }
예제 #2
0
        public IActionResult Sitemap()
        {
            var sitemapItems = new List <SitemapItem>
            {
                new SitemapItem(GetAbsoluteUrl("Home", "Index"), null, SitemapChangeFrequency.Hourly, 0.9),
                new SitemapItem(GetAbsoluteUrl("Home", "Minifiers"), null, SitemapChangeFrequency.Daily, 0.7),
                new SitemapItem(GetAbsoluteUrl("HtmlMinifier", "Index"), null, SitemapChangeFrequency.Daily, 0.5),
                new SitemapItem(GetAbsoluteUrl("XhtmlMinifier", "Index"), null, SitemapChangeFrequency.Daily, 0.5),
                new SitemapItem(GetAbsoluteUrl("XmlMinifier", "Index"), null, SitemapChangeFrequency.Daily, 0.5),
                new SitemapItem(GetAbsoluteUrl("Home", "Changelog"), null, SitemapChangeFrequency.Daily, 0.8),
                new SitemapItem(GetAbsoluteUrl("Home", "Contact"), null, SitemapChangeFrequency.Weekly, 0.4)
            };

            XDocument xmlSitemap = _sitemapService.GenerateXmlSiteMap(sitemapItems);

            return(new ContentResult
            {
                Content = xmlSitemap.ToString(),
                ContentType = "text/xml"
            });
        }
예제 #3
0
        public ActionResult Sitemap()
        {
            var sitemapItems = new List <SitemapItem>
            {
                new SitemapItem(GetAbsoluteUrl("home", "index"), null, SitemapChangeFrequency.Hourly, 0.9),
                new SitemapItem(GetAbsoluteUrl("home", "minifiers"), null, SitemapChangeFrequency.Daily, 0.7),
                new SitemapItem(GetAbsoluteUrl("html-minifier", "index"), null, SitemapChangeFrequency.Daily, 0.5),
                new SitemapItem(GetAbsoluteUrl("xhtml-minifier", "index"), null, SitemapChangeFrequency.Daily, 0.5),
                new SitemapItem(GetAbsoluteUrl("xml-minifier", "index"), null, SitemapChangeFrequency.Daily, 0.5),
                new SitemapItem(GetAbsoluteUrl("home", "change-log"), null, SitemapChangeFrequency.Daily, 0.8),
                new SitemapItem(GetAbsoluteUrl("home", "contact"), null, SitemapChangeFrequency.Weekly, 0.4)
            };

            XDocument xmlSitemap = _sitemapService.GenerateXmlSiteMap(sitemapItems);

            return(new ContentResult
            {
                Content = xmlSitemap.ToString(),
                ContentType = "text/xml",
                ContentEncoding = Encoding.UTF8
            });
        }