Making wordpress Comment pages more SEO-friendly

Source: Internet
Author: User
This article will benefit you for the rest of your life. I suggest you take a closer look. I have seen some articles about wordpress comments pagination which is not conducive to SEO over the past few days. Some Comments pagination is not recommended on the Internet. The following is a summary: the comment page leads to repeated titles under different links, repeated meta descriptions, and the same article content. disable

This article will benefit you for the rest of your life. I suggest you take a closer look. I have seen some articles about wordpress comments pagination which is not conducive to SEO over the past few days. Some Comments pagination is not recommended on the Internet. The following is a summary: the comment page leads to repeated titles under different links, repeated meta descriptions, and the same article content. disable

This article will benefit you for the rest of your life. I suggest you take a closer look.
I have seen some articles about wordpress comments pagination which is not conducive to SEO over the past few days. Some Comments pagination is not recommended on the Internet. The following is a summary: the comment page leads to repeated titles under different links, repeated meta descriptions, and the same article content.
If you do not enable the comments page, it will take me a long time. You know how long the comments are. so, you still need to split the pages. SEO also requires both drops. You can get both the fish and the bear's paw!

Solve the Problem of repeated titles

In your topic'sheader.phpFind similar code:

<? Phpglobal $ page, $ paged; wp_title ('|', true, 'right'); bloginfo ('name '); if ($ paged> = 2 | $ page> = 2) echo '| '. sprintf (_ ('page % s', 'xiaohudie '), max ($ paged, $ page);?>

Change

<? Phpglobal $ page, $ paged; wp_title ('|', true, 'right'); bloginfo ('name '); if ($ paged> = 2 | $ page> = 2) echo '| '. sprintf (_ ('page % s', 'xiaohudie '), max ($ paged, $ page); if (! Empty ($ cpage) // If the comment page is not the first echo '| '. sprintf (_ ('comment % s page', 'xiaohudie'), $ cpage);?>

Effect

Solve the Problem of repeated metadata descriptions

If your topic header label has the description function, you can add the following code at the end.

If ($ paged> = 2 | $ page> = 2) {$ description. = ': nth '. max ($ paged, $ page ). 'page';} if (! Empty ($ cpage) {$ description = sprintf ('% 2 $ s page of comment in % 1 $ s: ', get_the_title (), $ cpage ). $ description ;}

$descriptionYou need to modify it according to the previous Code. If you do not have this function on the topic, go online and find relevant tutorials. This is not covered in this article.
This Code also solves the problem of duplicate homepage page titles.

Solve the same article content

There is a plug-in to implement this function: Paged Comments SEO, you can also directly throw the following code to functions. php

Function xiaohudie_seo_paged_comments ($ new_content = '') {if (! Empty ($ cpage) {remove_filter ('the _ content', 'xiaohudie _ seo_paged_comments '); // remove the original content $ new_content = sprintf ('the Page % 2 $ s you are commenting on % 1 $ s', get_the_title (), $ cpage ); $ new_content. ='
 
 
'. Mb_strimwidth (get_the_content (), 0,200 ).'
'; // $ New_content. ='
'. Get_the_excerpt ().'
'; // If your topic contains a truncated abstract or your article has a abstract, you can replace the previous line with this line.} return $ new_content;} add_filter ('the _ content ', 'xiaohudie _ seo_paged_comments ');

Effect


DEMO address: Give it to anyone. Here

Original article address: the wordpress Comment page is more conducive to SEO, thanks to the original author for sharing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.