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

Add logic for exclude post type archives from sitemaps #7668

Merged
merged 4 commits into from
Aug 24, 2017

Conversation

stodorovic
Copy link
Contributor

@stodorovic stodorovic commented Aug 11, 2017

Summary

This PR can be summarized in the following changelog entry:

  • Archive pages are included in sitemap based on meta robots tag. (Props: @stodorovic)

Relevant technical choices:

Test instructions

This PR can be tested by following these steps:

  • Create new post_type with archive page (or install woocommerce - post_type product).
  • Open Titles & Metas -> Post Types -> Custom Post Type Archives -> Set noindex for archive page
  • Open sitemap for this post_type. Archive page URL isn't included into sitemap.

Fixes #7667
It's workaround for #7002, #7557 and similar issues.

Copy link
Contributor

@andizer andizer left a comment

Choose a reason for hiding this comment

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

Thank you for your pull request.

I've one minor comment.

return false;
}

$archive_url = get_post_type_archive_link( $post_type );
Copy link
Contributor

Choose a reason for hiding this comment

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

You might consider putting this after the if-statement as a minor optimization.

}

return $archive_url;

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove this newline?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants