Skip to content

Commit 39616dc

Browse files
authored
Merge pull request #404 from extractus/8.0.12
v8.0.12
2 parents 588f6ff + b7de5c4 commit 39616dc

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "8.0.11",
2+
"version": "8.0.12",
33
"name": "@extractus/article-extractor",
44
"description": "To extract main article from given URL",
55
"homepage": "https://github.com/extractus/article-extractor",

src/utils/extractLdSchema.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default (document, entry) => {
5656

5757
ldSchemas.forEach(ldSchema => {
5858
const ldJson = parseJson(ldSchema.textContent.replace(/[\n\r\t]/g, ''))
59-
const isAllowedLdJsonType = typeSchemas.includes(ldJson['@type'].toLowerCase())
59+
const isAllowedLdJsonType = typeSchemas.includes(ldJson['@type']?.toLowerCase())
6060

6161
if (ldJson && isAllowedLdJsonType) {
6262
Object.entries(attributeLists).forEach(([key, attr]) => {

test-data/regular-article-json-ld.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,27 @@
1212
<meta property="og:title" content="Article title here">
1313
<meta property="og:url" content="https://somewhere.com/path/to/article-title-here">
1414

15+
<script type="application/ld+json">
16+
[{ "@context": "https://schema.org",
17+
"@type": "SomeRandomType",
18+
"author": "Alice",
19+
"keywords": "keyword1, keyword2, keyword3",
20+
"keywords_with_line_breaks": "keyword1, keyword2,
21+
keyword3",
22+
"datePublished": "23\/01\/2014",
23+
"dateCreated": "23\/01\/2014"
24+
},
25+
{ "@context": "https://schema.org",
26+
"@type": "AnotherRandomType",
27+
"author": {
28+
"@type": "Person",
29+
"name": "Alice"
30+
},
31+
"keywords": "keyword1, keyword2, keyword3",
32+
"keywords_with_line_breaks": "keyword1, keyword2,
33+
keyword3"
34+
}]
35+
</script>
1536

1637
<script type="application/ld+json">
1738
{ "@context": "https://schema.org",

0 commit comments

Comments
 (0)