[BUGFIX] Make sure a twitter:card metatag is rendered 47/60647/3
authorRichard Haeser <richard@maxserv.com>
Fri, 3 May 2019 08:51:54 +0000 (10:51 +0200)
committerFrank Naegler <frank.naegler@typo3.org>
Sun, 5 May 2019 19:25:46 +0000 (21:25 +0200)
To get a valid Twitter card, you need to specify the type of card
by setting the twitter:card metatag. The value of this metatag is
now set to summary by default. If this value need to be changed, you
can use the MetaTag API and set the twitter:card property with the
replace option enabled.

Resolves: #88258
Releases: master, 9.5
Change-Id: Iaeaafb2408102c2844623155611cffffa8919d43
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60647
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Guido Schmechel <guido.schmechel@brandung.de>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Guido Schmechel <guido.schmechel@brandung.de>
Reviewed-by: Riny van Tiggelen <info@online-gamer.nl>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/seo/Classes/MetaTag/MetaTagGenerator.php

index 45da817..df66418 100644 (file)
@@ -79,6 +79,13 @@ class MetaTagGenerator
             }
         }
 
+        /*
+         * Set type of twitter card to summary. This value can be overridden by TypoScript or the MetaTag API by
+         * using the replace option. In v10 this will be a page property
+        */
+        $manager = $metaTagManagerRegistry->getManagerForProperty('twitter:card');
+        $manager->addProperty('twitter:card', 'summary');
+
         if (!empty($params['page']['twitter_title'])) {
             $manager = $metaTagManagerRegistry->getManagerForProperty('twitter:title');
             $manager->addProperty('twitter:title', $params['page']['twitter_title']);