Skip to content

Commit a247f4a

Browse files
authored
Merge pull request #427 from skatetdieu/master
Added a few more ways to get content from metadata tags
2 parents 39fe12e + 933c9d3 commit a247f4a

File tree

6 files changed

+33
-5
lines changed

6 files changed

+33
-5
lines changed

src/Detectors/AuthorName.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ public function detect(): ?string
1616
'book:author',
1717
'sailthru.author',
1818
'lp.article:author',
19-
'twitter:creator'
19+
'twitter:creator',
20+
'dcterms.creator',
21+
'author'
2022
);
2123
}
2224
}

src/Detectors/Description.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,17 @@ public function detect(): ?string
1212
$ld = $this->extractor->getLinkedData();
1313

1414
return $oembed->str('description')
15-
?: $metas->str('og:description', 'twitter:description', 'lp:description', 'description')
15+
?: $metas->str(
16+
'og:description',
17+
'twitter:description',
18+
'lp:description',
19+
'description',
20+
'article:description',
21+
'dcterms.description',
22+
'sailthru.description',
23+
'excerpt',
24+
'article.summary'
25+
)
1626
?: $ld->str('description');
1727
}
1828
}

src/Detectors/Keywords.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public function detect(): array
1818
'og:video:tag',
1919
'og:book:tag',
2020
'lp.article:section',
21+
'dcterms.subject'
2122
];
2223

2324
foreach ($types as $type) {

src/Detectors/ProviderName.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ public function detect(): string
1313
$metas = $this->extractor->getMetas();
1414

1515
return $oembed->str('provider_name')
16-
?: $metas->str('og:site_name')
16+
?: $metas->str(
17+
'og:site_name',
18+
'dcterms.publisher',
19+
'publisher',
20+
'article:publisher'
21+
)
1722
?: ucfirst($this->fallback());
1823
}
1924

src/Detectors/PublishedTime.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public function detect(): ?Datetime
3838
'rc.datecreation',
3939
'timestamp',
4040
'sailthru.date',
41-
'article:modified_time'
41+
'article:modified_time',
42+
'dcterms.date'
4243
);
4344
}
4445

src/Detectors/Title.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,16 @@ public function detect(): ?string
1212
$metas = $this->extractor->getMetas();
1313

1414
return $oembed->str('title')
15-
?: $metas->str('og:title', 'twitter:title', 'lp:title')
15+
?: $metas->str(
16+
'og:title',
17+
'twitter:title',
18+
'lp:title',
19+
'dcterms.title',
20+
'article:title',
21+
'headline',
22+
'article.headline',
23+
'parsely-title'
24+
)
1625
?: $document->select('.//head/title')->str();
1726
}
1827
}

0 commit comments

Comments
 (0)