生成百度 Sitemap XML 文件。就相当于网站被百度--全球最大的中文搜索引擎订阅,进而为您的网站带来潜在的流量。同时生成一个静态的站点地图页面,对所有的搜索引擎都有利。
登录wordpress后台下载baidu-sitemap-generator插件并启用该插件
下面重点介绍如何在SAE上使用baidu-sitemap-generator
在文件的根目录中找到config.yaml文件加入
- rewrite: if ( path ~ "sitemap_baidu.xml" ) goto "wp-content/plugins/baidu-sitemap-generator/SAE_xml.php"
- rewrite: if ( path ~ "sitemap.html" ) goto "wp-content/plugins/baidu-sitemap-generator/SAE_html.php"两句代码
在baidu-sitemap-generator目录下分别新建SAE_html.php和SAE_xml.php文件
加入
header("Content-Type:text/html");
$f = new SaeFetchurl();
$data = $f->fetch("http://shopsale-wordpress.stor.sinaapp.com/sitemap.html");
echo $data;
?>
和
header("Content-Type:text/xml");
$f = new SaeFetchurl();
$data = $f->fetch("http://shopsale-wordpress.stor.sinaapp.com/sitemap_baidu.xml");
echo $data;
?>
代码。
http://shopsale.sinaapp.com/conditioner.html
http://shopsale.sinaapp.com/shampoo.html
http://shopsale.sinaapp.com/intestinal_health.html