[dyad] Added schema display tab - wrote 3 file(s)
This commit is contained in:
@@ -57,12 +57,15 @@ export async function extractMetaData(url: string, keyword?: string) {
|
||||
const image = $('meta[property="og:image"]').attr("content") || null;
|
||||
|
||||
const faqData: FaqItem[] = [];
|
||||
const schemaData: any[] = [];
|
||||
$('script[type="application/ld+json"]').each((i, el) => {
|
||||
const jsonContent = $(el).html();
|
||||
if (!jsonContent) return;
|
||||
|
||||
try {
|
||||
const data = JSON.parse(jsonContent);
|
||||
schemaData.push(data);
|
||||
|
||||
const graph = data["@graph"] || [data];
|
||||
|
||||
for (const item of graph) {
|
||||
@@ -171,6 +174,7 @@ export async function extractMetaData(url: string, keyword?: string) {
|
||||
description,
|
||||
image,
|
||||
faq: faqData.length > 0 ? faqData : null,
|
||||
schema: schemaData.length > 0 ? schemaData : null,
|
||||
headlines: headlines.length > 0 ? headlines : null,
|
||||
keyword: trimmedKeyword || null,
|
||||
keywordCount,
|
||||
|
||||
Reference in New Issue
Block a user