[TASK] Do not render robots metatag on pages with index,follow 90/58590/3
authorRichard Haeser <richard@maxserv.com>
Sat, 6 Oct 2018 19:17:57 +0000 (21:17 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Thu, 11 Oct 2018 06:58:20 +0000 (08:58 +0200)
Index,follow is default behaviour for robots. In case that a page have
the index and follow attributes, the robots tag is not generated in
frontend.

Resolves: #86570
Releases: master
Change-Id: I951a25150f48bc16e15e8d10516be0347632cea0
Reviewed-on: https://review.typo3.org/58590
Tested-by: TYPO3com <no-reply@typo3.com>
Tested-by: Riccardo De Contardi <erredeco@gmail.com>
Reviewed-by: Łukasz Uznański <l.uznanski@macopedia.pl>
Tested-by: Łukasz Uznański <l.uznanski@macopedia.pl>
Reviewed-by: Josef Glatz <josef.glatz@typo3.org>
Tested-by: Josef Glatz <josef.glatz@typo3.org>
Reviewed-by: Marc Hirdes <hirdes@clickstorm.de>
Tested-by: Marc Hirdes <hirdes@clickstorm.de>
Reviewed-by: Jörg Bösche <typo3@joergboesche.de>
Tested-by: Jörg Bösche <typo3@joergboesche.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/seo/Classes/MetaTag/MetaTagGenerator.php

index ef77f74..a0b4caa 100644 (file)
@@ -113,8 +113,10 @@ class MetaTagGenerator
         $noIndex = ((bool)$params['page']['no_index']) ? 'noindex' : 'index';
         $noFollow = ((bool)$params['page']['no_follow']) ? 'nofollow' : 'follow';
 
-        $manager = $metaTagManagerRegistry->getManagerForProperty('robots');
-        $manager->addProperty('robots', implode(',', [$noIndex, $noFollow]));
+        if ($noIndex === 'noindex' || $noFollow === 'nofollow') {
+            $manager = $metaTagManagerRegistry->getManagerForProperty('robots');
+            $manager->addProperty('robots', implode(',', [$noIndex, $noFollow]));
+        }
     }
 
     /**