A+ Sitemap生成器说明书
本文地址:http://blog.csdn.net/aimeast/archive/2009/02/19/3911971.aspx
下载地址:http://download.csdn.net/source/1025534
本程序具有以下特点:
支持所有的动态系统
能够根据不同的论坛、Blog系统动态的生成Sitemap。支持动态、静态页面的生成。
具有丰富的配置文件。
可针对不同的页面设置不同的changefreq、priority等值。每个组件都有独立的配置。
生成速度快
不需要遍历整个网站就能生成Sitemap。中型论坛可以在不到10秒钟就生成整个Sitemap。更加节省了网络带宽、降低了服务器负荷。
扩展性强
运用设计模式,具有非常好的可扩展性。可以随意的增改组件。
程序的目录结构
Sitemap
│ Global.asax
│ MakeSitemap.aspx 手动生成器
│ Sitemap.config 全局配置文件
│ Sitemap.txt 生成好的Txt格式的Sitemap
│ Sitemap.txt.aspx 显示Sitemap.txt
│ Sitemap.xml 生成好的Xml格式的Sitemap
│ Sitemap.xml.aspx 显示Sitemap.xml
│ web.config
│
├─App_Code
│ Sitemap_BbsDB.cs 动态生成组件
│ Sitemap_Exception.cs 异常定义
│ Sitemap_Mange.cs 所有的框架和管理类
│ Sitemap_StaticList.cs 静态列表生成组件
│
└─App_Data
SitemapBbsDbList.xml 动态生成组件的配置文件
SitemapStaticList.txt 静态列表生成组件的配置文件
进行配置
/Sitemap.config
<?xml version="1.0" encoding="utf-8" ?>
<SitemapConfig><!-- 配置的根节点 -->
<Ver>0.1</Ver><!-- 版本号必须为0.1 -->
<Format FilePath="Sitemap.xml">Xml</Format><!-- 保存一个Sitemap.xml为Xml格式 -->
<Format FilePath="Sitemap.txt">Text</Format><!-- 保存一个Sitemap.txt为Text格式 -->
<AutoMake>True</AutoMake><!-- 是否启用自动生成 可选值为
True|False -->
<IngoreComponentException>True</IngoreComponentException><!-- 当一个组件出现错误时,是否忽略错误 可选值为
True|False -->
<Maker>
<!-- 组件的单独配置 必须要有版本,其他参数为自定义参数 -->
<StaticList><!-- 组件的类的名称 必须与代码中的一样 -->
<Ver>0.1</Ver><!-- 版本号 -->
<FilePath>App_Data/SitemapStaticList.txt</FilePath><!-- 静态列表保存的相对路径 不能使用MapPath的“.”“~”等标记 -->
<LastModDateTime>Auto</LastModDateTime><!-- 最后修改时间 auto为列表的最后修改时间
-->
<ChangeFreq>monthly</ChangeFreq><!-- 改变频率 -->
<Priority>0.5</Priority><!-- 重要系数 -->
</StaticList>
<BbsDB>
<Ver>0.1</Ver><!-- 版本号 -->
<DbType>Access</DbType><!-- 数据库类型 -->
<ConnStr>Provider=Microsoft.Jet.OleDb.4.0;Data
Source=F:/Work/Inetpub/yo612.cn/www/App_Data/dznt_db.mdb;Persist Security
Info=True;</ConnStr><!-- 数据库连接串 -->
<FilePath>App_Data/SitemapBbsDbList.xml</FilePath><!-- 生成方法的相对路径 不能使用MapPath的“.”“~”等标记 -->
</BbsDB>
</Maker>
</SitemapConfig>
/App_Data/
SitemapStaticList.txt
保存Url,每行一个。
/App_Data/SitemapBbsDbList.xml(部分)
<?xml version="1.0" encoding="utf-8" ?>
<BbsDbList><!-- 根节点 -->
<Group changefreq="always" priority="1" table="" field="" where="">
<!-- table是要查询的表
field是要查询的字段 目前只支持一个字段 where是查询的条件 可以为空 -->
<Item>http://www.yo612.cn/dznt/</Item><!-- Item是使用这以查询的url。参数用String.Format格式化字符串表示 -->
<Item>http://www.yo612.cn/dznt/index.aspx</Item>
</Group>
<Group changefreq="always" priority="0.9" table="dnt_forums" field="fid" where="">
<Item>http://www.yo612.cn/dznt/archiver/showforum-{0}.aspx</Item>
</Group>
<Group changefreq="daily" priority="0.85" table="dnt_topics" field="tid" where="">
<Item>http://www.yo612.cn/dznt/archiver/showtopic-{0}.aspx</Item>
<Item>http://www.yo612.cn/dznt/showtopic-{0}.aspx</Item>
</Group<