コード例 #1
0
        /// <summary>
        /// 生成站点地图
        /// </summary>
        protected void CreateSitemap()
        {
            DataEntities ent = new DataEntities();

            Voodoo.other.SEO.SiteMap sm = new Voodoo.other.SEO.SiteMap();
            sm.url = new List <PageInfo>();

            sm.url.Add(new PageInfo()
            {
                changefreq = "always", lastmod = DateTime.Now, loc = Voodoo.Basement.BasePage.SystemSetting.SiteUrl, priority = "1.0"
            });
            List <Book> bs = //BookView.GetModelList("id>0 order by UpdateTime desc", 100);
                             (from l in ent.Book orderby l.UpdateTime descending select l).Take(100).ToList();

            foreach (Book b in bs)
            {
                sm.url.Add(new PageInfo()
                {
                    changefreq = "daily",
                    lastmod    = b.UpdateTime.ToDateTime(),
                    loc        = (Voodoo.Basement.BasePage.SystemSetting.SiteUrl + BasePage.GetBookUrl(b, b.GetClass())).Replace("//Book/", "/Book/"),
                    priority   = "0.8"
                });
            }

            List <BookChapter> bcs = //BookChapterView.GetModelList("id>0 order by UpdateTime desc", 500);
                                     (from l in ent.BookChapter orderby l.UpdateTime descending select l).Take(500).ToList();

            foreach (BookChapter bc in bcs)
            {
                sm.url.Add(new PageInfo()
                {
                    changefreq = "monthly",
                    lastmod    = bc.UpdateTime,
                    loc        = (Voodoo.Basement.BasePage.SystemSetting.SiteUrl + BasePage.GetBookChapterUrl(bc, bc.GetClass())).Replace("//Book/", "/Book/"),
                    priority   = "0.7"
                });
            }
            try
            {
                sm.SaveSiteMap(Server.MapPath("~/sitemapxml/index.xml"));
                Response.Clear();
                Response.Write(XML.Serialize(true));
            }
            catch
            {
                Response.Clear();
                Response.Write(XML.Serialize(false));
            }
            finally
            {
                ent.Dispose();
            }
        }
コード例 #2
0
        /// <summary>
        /// 生成站点地图
        /// </summary>
        protected void CreateSitemap()
        {
            Voodoo.other.SEO.SiteMap sm = new Voodoo.other.SEO.SiteMap();
            sm.url = new List <PageInfo>();

            sm.url.Add(new PageInfo()
            {
                changefreq = "always", lastmod = DateTime.Now, loc = Voodoo.Basement.BasePage.SystemSetting.SiteUrl, priority = "1.0"
            });
            List <Voodoo.Model.Book> bs = BookView.GetModelList("id>0 order by UpdateTime desc", 100);

            foreach (Voodoo.Model.Book b in bs)
            {
                sm.url.Add(new PageInfo()
                {
                    changefreq = "daily",
                    lastmod    = b.UpdateTime,
                    loc        = (Voodoo.Basement.BasePage.SystemSetting.SiteUrl + BasePage.GetBookUrl(b, BookView.GetClass(b))).Replace("//Book/", "/Book/"),
                    priority   = "0.8"
                });
            }

            List <BookChapter> bcs = BookChapterView.GetModelList("id>0 order by UpdateTime desc", 500);

            foreach (BookChapter bc in bcs)
            {
                sm.url.Add(new PageInfo()
                {
                    changefreq = "monthly",
                    lastmod    = bc.UpdateTime,
                    loc        = (Voodoo.Basement.BasePage.SystemSetting.SiteUrl + BasePage.GetBookChapterUrl(bc, BookView.GetClass(bc))).Replace("//Book/", "/Book/"),
                    priority   = "0.7"
                });
            }
            try
            {
                sm.SaveSiteMap(Server.MapPath("~/sitemapxml/index.xml"));
                Response.Clear();
                Response.Write(XML.Serialize(true));
            }
            catch
            {
                Response.Clear();
                Response.Write(XML.Serialize(false));
            }
        }
コード例 #3
0
        protected void btn_GenSitreMap_Click(object sender, EventArgs e)
        {
            Voodoo.other.SEO.SiteMap sm = new Voodoo.other.SEO.SiteMap();
            sm.url = new List <PageInfo>();

            sm.url.Add(new PageInfo()
            {
                changefreq = "always", lastmod = DateTime.Now, loc = SystemSetting.SiteUrl, priority = "1.0"
            });

            DataEntities ent = new DataEntities();
            List <Voodoo.Basement.Book> bs = //BookView.GetModelList("id>0 order by UpdateTime desc", 100);
                                             (from l in ent.Book orderby l.UpdateTime descending select l).Take(100).ToList();

            foreach (Voodoo.Basement.Book b in bs)
            {
                sm.url.Add(new PageInfo()
                {
                    changefreq = "daily",
                    lastmod    = b.UpdateTime.ToDateTime(),
                    loc        = (SystemSetting.SiteUrl + BasePage.GetBookUrl(b, b.GetClass())).Replace("//Book/", "/Book/"),
                    priority   = "0.8"
                });
            }

            List <BookChapter> bcs = //BookChapterView.GetModelList("id>0 order by UpdateTime desc", 500);
                                     (from l in ent.BookChapter orderby l.UpdateTime descending select l).Take(500).ToList();

            foreach (BookChapter bc in bcs)
            {
                sm.url.Add(new PageInfo()
                {
                    changefreq = "monthly",
                    lastmod    = bc.UpdateTime,
                    loc        = (SystemSetting.SiteUrl + BasePage.GetBookChapterUrl(bc, bc.GetClass())).Replace("//Book/", "/Book/"),
                    priority   = "0.7"
                });
            }

            ent.Dispose();
            sm.SaveSiteMap(Server.MapPath("~/sitemapxml/index.xml"));
        }
コード例 #4
0
        protected void btn_GenSitreMap_Click(object sender, EventArgs e)
        {
            Voodoo.other.SEO.SiteMap sm = new Voodoo.other.SEO.SiteMap();
            sm.url = new List <PageInfo>();

            sm.url.Add(new PageInfo()
            {
                changefreq = "always", lastmod = DateTime.Now, loc = SystemSetting.SiteUrl, priority = "1.0"
            });
            List <Voodoo.Model.Book> bs = BookView.GetModelList("id>0 order by UpdateTime desc", 100);

            foreach (Voodoo.Model.Book b in bs)
            {
                sm.url.Add(new PageInfo()
                {
                    changefreq = "daily",
                    lastmod    = b.UpdateTime,
                    loc        = (SystemSetting.SiteUrl + BasePage.GetBookUrl(b, BookView.GetClass(b))).Replace("//Book/", "/Book/"),
                    priority   = "0.8"
                });
            }

            List <BookChapter> bcs = BookChapterView.GetModelList("id>0 order by UpdateTime desc", 500);

            foreach (BookChapter bc in bcs)
            {
                sm.url.Add(new PageInfo()
                {
                    changefreq = "monthly",
                    lastmod    = bc.UpdateTime,
                    loc        = (SystemSetting.SiteUrl + BasePage.GetBookChapterUrl(bc, BookView.GetClass(bc))).Replace("//Book/", "/Book/"),
                    priority   = "0.7"
                });
            }


            sm.SaveSiteMap(Server.MapPath("~/sitemapxml/index.xml"));
        }
コード例 #5
0
ファイル: xmlrpc.aspx.cs プロジェクト: kuibono/KCMS2
        /// <summary>
        /// 生成站点地图
        /// </summary>
        protected void CreateSitemap()
        {
            DataEntities ent = new DataEntities();

            Voodoo.other.SEO.SiteMap sm = new Voodoo.other.SEO.SiteMap();
            sm.url = new List<PageInfo>();

            sm.url.Add(new PageInfo() { changefreq = "always", lastmod = DateTime.Now, loc = Voodoo.Basement.BasePage.SystemSetting.SiteUrl, priority = "1.0" });
            List<Book> bs = //BookView.GetModelList("id>0 order by UpdateTime desc", 100);
                (from l in ent.Book orderby l.UpdateTime descending select l).Take(100).ToList();
            foreach (Book b in bs)
            {
                sm.url.Add(new PageInfo()
                {
                    changefreq = "daily",
                    lastmod = b.UpdateTime.ToDateTime(),
                    loc = (Voodoo.Basement.BasePage.SystemSetting.SiteUrl + BasePage.GetBookUrl(b, b.GetClass())).Replace("//Book/", "/Book/"),
                    priority = "0.8"
                });
            }

            List<BookChapter> bcs = //BookChapterView.GetModelList("id>0 order by UpdateTime desc", 500);
                (from l in ent.BookChapter orderby l.UpdateTime descending select l).Take(500).ToList();
            foreach (BookChapter bc in bcs)
            {
                sm.url.Add(new PageInfo()
                {
                    changefreq = "monthly",
                    lastmod = bc.UpdateTime,
                    loc = (Voodoo.Basement.BasePage.SystemSetting.SiteUrl + BasePage.GetBookChapterUrl(bc, bc.GetClass())).Replace("//Book/", "/Book/"),
                    priority = "0.7"
                });
            }
            try
            {
                sm.SaveSiteMap(Server.MapPath("~/sitemapxml/index.xml"));
                Response.Clear();
                Response.Write(XML.Serialize(true));
            }
            catch
            {
                Response.Clear();
                Response.Write(XML.Serialize(false));
            }
            finally
            {
                ent.Dispose();
            }
        }