Saturday, November 23, 2024
spot_img

Top 5 This Week

Related Posts

How we hacked the Baidu link submission script for better indexation

Baidu Search Ss 1920

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.

Baidu Link Submission ScriptBaidu Link Submission Script

Baidu Link Submission Script

How the script works

The script simply checks the protocol of your page and selectively downloads a JavaScript (JS) file from Baidu. It copies the script in the file and creates a node of <script> on your page. The copied script then takes the URL of the current page, plus the referrer URL of the page, as the parameters when requesting a GIF file (a 1×1 pixel GIF for carrying the parameters) from Baidu.

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.

The improved Baidu Link Submission Script by MerkleThe improved Baidu Link Submission Script by Merkle

The improved Baidu Link Submission Script by Merkle

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.

Last thoughts

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.

Code snippet


Contributing authors are invited to create content for Search Engine Land and are chosen for their expertise and contribution to the search community. Our contributors work under the oversight of the editorial staff and contributions are checked for quality and relevance to our readers. The opinions they express are their own.


Popular Articles