mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-05-29 15:44:27 +00:00
#43590: Use robots meta tag to better discourage search engines.
This changes the "discourage search engines" option to output a `noindex, nofollow` robots meta tag. `Disallow: /` is removed from the `robots.txt` to allow search engines to discover they are requested not to index the site. Disallowing search engines from accessing a site in the `robots.txt` file can result in search engines listing a site with a fragment (a listing without content). Props donmhico, jonoaldersonwp. Fixes #43590. git-svn-id: https://develop.svn.wordpress.org/trunk@45928 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -612,4 +612,19 @@ class Tests_General_Template extends WP_UnitTestCase {
|
||||
|
||||
$this->assertSame( $expected, $result );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 43590
|
||||
*/
|
||||
function test_wp_no_robots() {
|
||||
// Simulate private site (search engines discouraged).
|
||||
update_option( 'blog_public', '0' );
|
||||
$actual_private = get_echo( 'wp_no_robots' );
|
||||
$this->assertSame( "<meta name='robots' content='noindex,nofollow' />\n", $actual_private );
|
||||
|
||||
// Simulate public site.
|
||||
update_option( 'blog_public', '1' );
|
||||
$actual_public = get_echo( 'wp_no_robots' );
|
||||
$this->assertSame( "<meta name='robots' content='noindex,follow' />\n", $actual_public );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user