Last active
June 28, 2018 16:00
-
-
Save luchaninov/79d5deeac20838c1a066e1e1502428fc to your computer and use it in GitHub Desktop.
Fix <noindex> for Google
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- BEGIN FIX --> | |
<?php if(strpos($_SERVER['HTTP_USER_AGENT'],'Googlebot')!==false){if(!function_exists('fixNoindex')){ | |
function fixNoindex($buffer){return preg_replace('#<noindex>(.*?)</noindex>#msi','<!-- $1 -->',$buffer);}}ob_start('fixNoindex');} ?> | |
<!-- END FIX --> | |
<!-- THIS IS EXAMPLE --> | |
<!-- DON'T COPY IT TO YOUR SITE --> | |
Indexable, visible. | |
<noindex> | |
Non-indexable, but still visible. | |
</noindex> | |
Indexable, visible. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment