@quintype/seo 1.52.2 → 1.53.0-author-page-schema.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +17 -3
- package/package.json +1 -1
- package/src/structured-data/schema.js +32 -9
package/dist/index.cjs.js
CHANGED
|
@@ -570,16 +570,30 @@ function generateAuthorPageSchema(publisherConfig, data, url) {
|
|
|
570
570
|
const authorHREF = url["href"];
|
|
571
571
|
const authorURL = `${sketchesHost}${authorHREF}`;
|
|
572
572
|
const authorName = lodash.get(data, ["author", "name"], "");
|
|
573
|
-
|
|
573
|
+
const authorImage = lodash.get(data, ["author", "avatar-url"], "");
|
|
574
|
+
const { knowsAbout, jobTitle } = lodash.get(data, ["author", "metadata"], {});
|
|
575
|
+
const social = lodash.get(data, ["author", "social"], {});
|
|
576
|
+
const normalizedKnowsAbout = (knowsAbout || "").split(",").map(topic => topic.trim()).filter(Boolean);
|
|
577
|
+
|
|
578
|
+
const sameAs = Object.values(social).reduce((acc, socialItem) => {
|
|
579
|
+
const rawUrl = lodash.get(socialItem, ["url"], "");
|
|
580
|
+
if (rawUrl && !acc.includes(rawUrl)) {
|
|
581
|
+
acc.push(rawUrl);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
return acc;
|
|
585
|
+
}, []);
|
|
586
|
+
const authorDescription = lodash.get(data, ["author", "bio"], "");
|
|
587
|
+
return Object.assign({
|
|
574
588
|
name: authorName,
|
|
575
|
-
jobTitle: "Author",
|
|
589
|
+
jobTitle: jobTitle || "Author",
|
|
576
590
|
url: authorURL,
|
|
577
591
|
worksFor: {
|
|
578
592
|
"@type": "NewsMediaOrganization",
|
|
579
593
|
name: publisherName,
|
|
580
594
|
url: sketchesHost
|
|
581
595
|
}
|
|
582
|
-
};
|
|
596
|
+
}, authorDescription && { description: authorDescription }, normalizedKnowsAbout.length > 0 && { knowsAbout: normalizedKnowsAbout }, sameAs.length > 0 && { sameAs }, authorImage && { image: authorImage });
|
|
583
597
|
}
|
|
584
598
|
|
|
585
599
|
function getMovieEntityTags(movieJson) {
|
package/package.json
CHANGED
|
@@ -130,14 +130,37 @@ export function generateAuthorPageSchema(publisherConfig, data, url) {
|
|
|
130
130
|
const authorHREF = url["href"];
|
|
131
131
|
const authorURL = `${sketchesHost}${authorHREF}`;
|
|
132
132
|
const authorName = get(data, ["author", "name"], "");
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
133
|
+
const authorImage = get(data, ["author", "avatar-url"], "");
|
|
134
|
+
const { knowsAbout, jobTitle } = get(data, ["author", "metadata"], {});
|
|
135
|
+
const social = get(data, ["author", "social"], {});
|
|
136
|
+
const normalizedKnowsAbout = (knowsAbout || "")
|
|
137
|
+
.split(",")
|
|
138
|
+
.map((topic) => topic.trim())
|
|
139
|
+
.filter(Boolean);
|
|
140
|
+
|
|
141
|
+
const sameAs = Object.values(social).reduce((acc, socialItem) => {
|
|
142
|
+
const rawUrl = get(socialItem, ["url"], "");
|
|
143
|
+
if (rawUrl && !acc.includes(rawUrl)) {
|
|
144
|
+
acc.push(rawUrl);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return acc;
|
|
148
|
+
}, []);
|
|
149
|
+
const authorDescription = get(data, ["author", "bio"], "");
|
|
150
|
+
return Object.assign(
|
|
151
|
+
{
|
|
152
|
+
name: authorName,
|
|
153
|
+
jobTitle: jobTitle || "Author",
|
|
154
|
+
url: authorURL,
|
|
155
|
+
worksFor: {
|
|
156
|
+
"@type": "NewsMediaOrganization",
|
|
157
|
+
name: publisherName,
|
|
158
|
+
url: sketchesHost,
|
|
159
|
+
},
|
|
141
160
|
},
|
|
142
|
-
|
|
161
|
+
authorDescription && { description: authorDescription },
|
|
162
|
+
normalizedKnowsAbout.length > 0 && { knowsAbout: normalizedKnowsAbout },
|
|
163
|
+
sameAs.length > 0 && { sameAs },
|
|
164
|
+
authorImage && { image: authorImage }
|
|
165
|
+
);
|
|
143
166
|
}
|