Add Baidu wireless sitemap to WordPress

888u

Last update at :2024-05-06,Edit by888u

Many friends like to use website building tools like WordPress, and the popularity rate is very high. Regardless of the purpose, getting their website to be included more by search engines seems to be something that many people are willing to do. Furthermore, Nowadays, mobile wireless is becoming more and more popular, so we need search engines to crawl more of our websites. Here I will simply write a sitemap solution for adding Baidu wireless protocol to WordPress. You can also think of other solutions by yourself.

Let’s first understand what sitemap protocol Baidu follows, because he is Baidu, not Baidu or Bing, and he really likes to work alone:

Baidu Mobile Sitemap Agreement: http://www.baidu.com/schemas/sitemap-mobile/1/sitemap-mobile.xsd Sitemap protocol: http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd

Next we need to make our own Baidu wireless sitemap for WordPress.

I am using the XML Sitemaps plug-in officially downloaded from WordPress.

The background XML Sitemap Settings contains:

Include Archive Pages Include Author Pages Empty Author Pages Include Category Pages Include Tag Pages Exclude Pages Generate Mobile Sitemap

My choice is to only check the three options 4, 5, and 7. The generated sitemap file is stored under \wp-content\sitemaps\.

When we access our sitemap file http://xx.com/sitemap.xml, we will find the following: http://localhost/blog 2015-06-10 …

We need to modify it. Open the xml-sitemaps-utils.php file in the plug-in and find it (it cannot be found at around line 850) /** * write_mobile() * * @param $loc * @return void */ Let’s change the following lines of code to something like this function write_mobile($loc, $lastmod = null) {

$o = ‘’ . “\n”; $o .= ‘’ . htmlentities($loc, ENT_COMPAT, ‘UTF-8’) . ‘’ . “\n”; $o .= ‘’ . “\n”; $o .= ‘’ . htmlentities($lastmod, ENT_COMPAT, ‘UTF-8’) . ‘’ . “\n”; $o .= ‘’ . “\n”;

The change is that this is Baidu's adaptive web page standard. Of course, you can also choose it yourself. Anyway, there are 4 choices [Reference]; the other one is to follow Baidu's format first "Agreement" and then "Date", but I guess it won't be a big problem if this is reversed.

It’s not over yet, continue reading to find: . ( $this->mobile_sitemap == true ? ‘ xmlns:mobile=”http://www.google.com/schemas/sitemap-mobile/1.0″‘ : ”)

Replace the Baidu 1.0 inside with Baidu’s xmlns="http://www.baidu.com/schemas/sitemap-mobile/1/" and that’s it!

Then we can log in to zhanzhang.baidu.com and submit our sitemap!

Recommended site search: Hong Kong vps host rental, Hong Kong cloud host, China domain name trading center, Hong Kong server, domain name space purchase, domain name registration official website, Korean agent ip, Hong Kong ip, server space rental, Ministry of Industry and Information Technology domain name registration query,

Add Baidu wireless sitemap to WordPress

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码