Display Your Article Table of Contents in Bing Search Result Page – WordPress Tutorial

By | December 25, 2020

Making search engine display the table of contents of article can help us to increase the traffic. In this tutorial, we will introduce you how to do.

Article table of contents in bing search page

When we are using bing search engine to search something, you may find this kind of search result.

Search result example 1:

display article table of contents in bing search result page example two

Search result example 2:

display article table of contents in bing search result page example one

In bing search result page, the table of contents of articles are displayed. This kind of search result is more distinct than others and can attract more user’s attention.

How to make bing search engine display the table of contents?

We will analyze these search results.

Look at search results in below.

Html source code example 1:

display article table of contents in bing search result page example four

Html source code example 2:display article table of contents in bing search result page example three

From the results we can find:

  • We should use h2 for the table of contents for our article.

How to fix the wordpress post content by adding h2?

If you have used strong or b to the text of table of contents in wordpress post, you can use the_content() function to fix them.

Here is a tutorial:

Implement WordPress add_filter the_content(): A Beginner Guide

As to us, we add code below to fix our post content in our wordpress theme functions.php file.

function show_content($content){
	if ( is_single() ){
		$pattern=array('!<p>[\t\n\r\f]{0,}<strong>([^<]{1,})</strong>[\t\n\r\f]{0,}</p>!is');
      $rep='<h2>${1}</h2>';

      $content = preg_replace($pattern,$rep,$content);
	}
	return $content;
}
add_filter("the_content",show_content);

Leave a Reply