

免费资源网 – https://freexyz.cn/
用shell快速生成xml格式的sitemap地图文件,中小型网站适用。在本次案例中,生成12053条URL的sitemap文件,仅用时4.3秒!shell代码如下:
复制代码代码如下:
cat sitemap.txt|awk BEGIN{print ” n”}{print “n”$0″n2014-07-18nalwaysn”}END{print “”}
其中sitemap.txt是网站所有URL的集合,<lastmod>后面的日期,需要修改为你当时生成sitemap文件时的日期,今天是2014年7月18日,所以我写的是这个。其实用txt格式的sitemap百度也是认可的,为了体现shell功能强大之处,我才在此非得把txt格式的折腾成xml格式的!!!sitemap.txt内容如下图,总共有12053条URL。
最终效果及生成速度,总共12053条URL,生成xml格式的sitemap,仅用时4.3秒!速度还是相当快的!
免费资源网 – https://freexyz.cn/
© 版权声明
THE END
暂无评论内容