Skip to content

Commit e6765b0

Browse files
committed
detected article:* meta-tags, improved authorUrl in twittercards
1 parent 191800b commit e6765b0

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/Providers/Html.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function getUrl()
106106
*/
107107
public function getAuthorName()
108108
{
109-
return $this->bag->get('author') ?: $this->bag->get('contributors');
109+
return $this->bag->get('author') ?: $this->bag->get('article:author') ?: $this->bag->get('contributors');
110110
}
111111

112112
/**
@@ -300,6 +300,10 @@ private function extractMetas(DOMDocument $html)
300300
if ($meta->hasAttribute('http-equiv')) {
301301
$this->bag->set($meta->getAttribute('http-equiv'), $value);
302302
}
303+
304+
if ($meta->hasAttribute('property')) {
305+
$this->bag->set($meta->getAttribute('property'), $value);
306+
}
303307
}
304308
}
305309

src/Providers/TwitterCards.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,18 @@ public function getAuthorName()
108108
return $this->bag->get('creator');
109109
}
110110

111+
/**
112+
* {@inheritdoc}
113+
*/
114+
public function getAuthorUrl()
115+
{
116+
$author = $this->getAuthorName();
117+
118+
if (!empty($author)) {
119+
return 'https://twitter.com/'.ltrim($author, '@');
120+
}
121+
}
122+
111123
/**
112124
* {@inheritdoc}
113125
*/

0 commit comments

Comments
 (0)