From 315aa787340c021de33e89cc90cdc66b9260863c Mon Sep 17 00:00:00 2001 From: Ben Wilkins Date: Thu, 25 May 2017 11:04:03 -0500 Subject: [PATCH] Update attribute names for twitter cards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the HTML parser, the attribute name was set to `value` rather than `content` for the `twitter:image` and `twitter:title` selectors. Per Twitter’s documentation, this attribute should be `content`. (See: https://dev.twitter.com/cards/types/summary) This causes valid HTML pages with correct Twitter card syntax to return an empty cover and title. For example, this URL: http://www.huffingtonpost.com/entry/the-missing-voice-the-missing-piece- where-are-the_us_576f5617e4b0fa01a14027df --- src/Parsers/HtmlParser.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Parsers/HtmlParser.php b/src/Parsers/HtmlParser.php index de0ff90..c8717cf 100644 --- a/src/Parsers/HtmlParser.php +++ b/src/Parsers/HtmlParser.php @@ -24,13 +24,13 @@ class HtmlParser extends BaseParser implements ParserInterface */ private $tags = [ 'cover' => [ - ['selector' => 'meta[property="twitter:image"]', 'attribute' => 'value'], + ['selector' => 'meta[property="twitter:image"]', 'attribute' => 'content'], ['selector' => 'meta[property="og:image"]', 'attribute' => 'content'], ['selector' => 'meta[itemprop="image"]', 'attribute' => 'content'], ], 'title' => [ - ['selector' => 'meta[property="twitter:title"]', 'attribute' => 'value'], + ['selector' => 'meta[property="twitter:title"]', 'attribute' => 'content'], ['selector' => 'meta[property="og:title"]', 'attribute' => 'content'], ['selector' => 'meta[itemprop="name"]', 'attribute' => 'content'], ['selector' => 'title']