update 09/02
This commit is contained in:
@@ -1,79 +0,0 @@
|
||||
import type { Metadata } from "next";
|
||||
|
||||
export function metadataBySlug(result: any): Metadata {
|
||||
|
||||
switch (result.type) {
|
||||
case "product_category":
|
||||
return {
|
||||
title: result.data.title,
|
||||
description: stripHtml(result.data.summary),
|
||||
openGraph: {
|
||||
type: 'website',
|
||||
images: [
|
||||
result.data.big_image
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
case "product_detail":
|
||||
return {
|
||||
title: result.data.productName,
|
||||
description: stripHtml(result.data.productSummary),
|
||||
openGraph: {
|
||||
type: 'website',
|
||||
images: [
|
||||
result.data.productImage.large.replace('/250_', '/')
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
case "article_home":
|
||||
return {
|
||||
title: "Tin tức",
|
||||
description: "Tin tức mới nhất",
|
||||
openGraph: {
|
||||
type: 'article',
|
||||
images: [
|
||||
result.data.productImage.large.replace('/250_', '/')
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
case "article_category":
|
||||
return {
|
||||
title: result.data.title,
|
||||
description: stripHtml(result.data.summary),
|
||||
openGraph: {
|
||||
type: 'article',
|
||||
images: [
|
||||
result.data.thumbnail
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
case "article_detail":
|
||||
return {
|
||||
title: result.data.title,
|
||||
description: result.data.excerpt,
|
||||
openGraph: {
|
||||
type: 'article',
|
||||
}
|
||||
};
|
||||
|
||||
default:
|
||||
return {
|
||||
title: "Local PC",
|
||||
openGraph: {
|
||||
type: 'website',
|
||||
images: [
|
||||
'/images/logo.png'
|
||||
],
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function stripHtml(html: string) {
|
||||
return html.replace(/<[^>]*>/g, '');
|
||||
}
|
||||
Reference in New Issue
Block a user