Sign up for our daily recaps of the ever-changing search marketing landscape.
How we hacked the Baidu link submission script for better indexation
Baidu's Link Submission Script is a great way to help Baidu index your content, but it can create some potential SEO issues. Columnist Hermes Ma shares an improved version of the script that is more SEO-friendly.
It is no secret that the Baidu Link Submission Script is an effective tool for surfacing links that are not quite visible to Baidu spiders. In Baidu’s own words (translated from Chinese):
By inserting the snippet into the source code of pages that you want Baidu to discover and index, it pushes the URL of the current page to Baidu automatically.
How the script works
Every time a visitor browses the page, the script is executed and Baidu will be notified. For example, if you were to drive a considerable amount of traffic to the pages, Baidu would know how important and popular the content is.
As you can see, the code snippet is straightforward and open to other configurations. For example, you may use it as an impression-tracking pixel. That gives us reason to believe that it won’t get high priority at Baidu. To be honest, we don’t think this will improve your ranking on Baidu. However, it does help the indexation of your site to some extent.
How we improved it
As a veteran of SEO, you may have noticed that submitting the URL of the current page does not follow the best practices, because:
- the URL may not be the canonical URL you want the engine to index.
- the script makes an extra request which is unnecessary and potentially slows down the page load speed.
- furthermore, those two JS files are static and are mostly identical, except the URL of the GIF you are requesting.
In order to tackle those issues, my colleague Woody Chai and I have tweaked the Baidu script a bit. See the code snippet below.
In the code snippet above, we added a step to check if the canonical directive exists and hard-copied the script by merging those two JS files. Now, we can push the canonical URL to Baidu by only one HTTP(S) request.
In this example of the improved Baidu Link Submission Script, we have demonstrated how we can make the script Baidu gave us more SEO-friendly. There is one thing you should keep in mind: The scripts (including the URL of the GIFs Baidu put in those JS files) may be changed in the future, though it hasn’t changed since day one. If you find any 404s of those resources, or any sign that the script is lagging the page load speed, you should go back to Baidu Webmaster Tools for updated solutions.
Opinions expressed in this article are those of the guest author and not necessarily Search Engine Land. Staff authors are listed here.