您的位置:首页 > 大数据 > 人工智能

wordpress插件之baidu-sitemap-generator

2013-10-20 14:43 399 查看
生成百度 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文件
加入
<?php
header("Content-Type:text/html");
$f = new SaeFetchurl();
$data = $f->fetch("http://shopsale-wordpress.stor.sinaapp.com/sitemap.html");
echo $data;
?>

<?php
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息