diff --git a/src/OpenGraph.php b/src/OpenGraph.php index a3e69e3..5b86ff2 100644 --- a/src/OpenGraph.php +++ b/src/OpenGraph.php @@ -27,6 +27,12 @@ public function fetch($url, $allMeta = null, $lang = null, $options = LIBXML_NOW $tags = $doc->getElementsByTagName('meta'); $metadata = []; + + if ($allMeta && !empty($doc->getElementsByTagName('title'))) { + $title = $doc->getElementsByTagName('title'); + $metadata['title'] = $title->length > 0 ? $title->item(0)->textContent : null; + } + foreach ($tags as $tag) { $metaproperty = ($tag->hasAttribute('property')) ? $tag->getAttribute('property') : $tag->getAttribute('name'); if (!$allMeta && $metaproperty && strpos($tag->getAttribute('property'), 'og:') === 0) {