Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not index comment pages and replytocom #187

Merged
merged 4 commits into from
Jan 16, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Do not index comment pages and replytocom
  • Loading branch information
nhatrangnet committed Jan 15, 2025
commit 6dfcfe957e6702acde39e7be76d3aee701170d29
10 changes: 5 additions & 5 deletions src/MetaTags/Robots.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ private function get_indexed() {
return false;
}

// Do not index pages with no content.
global $wp_query;
if ( ! is_front_page() && ! $wp_query->post_count ) {
// Do not index comment pages and replytocom
if ( is_singular() && get_query_var('cpage' ) || isset( $_GET['replytocom'] ) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sửa lại điều kiện, thêm ngoặc vào cho hợp lý:

if ( is_singular() && ( get_query_var('cpage' ) || isset( $_GET['replytocom'] ) ) ) {

return false;
}

// Do not index comment pages and replytocom
if ( is_singular('post') && get_query_var('cpage' ) || isset( $_GET['replytocom'] ) ) {
// Do not index pages with no content.
global $wp_query;
if ( ! is_front_page() && ! $wp_query->post_count ) {
return false;
}
rilwis marked this conversation as resolved.
Show resolved Hide resolved

Expand Down