fix metadata
parent
1677c7f785
commit
ad296199df
|
@ -1,5 +1,6 @@
|
|||
NODE_ENV="production"
|
||||
|
||||
NEXT_PUBLIC_APP_URL=https://vesmeh.com
|
||||
NEXT_PUBLIC_SERVER_URL=https://api.vesmeh.com
|
||||
NEXT_PUBLIC_PUBLIC_URL=https://api.vesmeh.com
|
||||
NEXT_PUBLIC_API_URL=https://api.vesmeh.com/api
|
||||
|
|
|
@ -10,15 +10,19 @@ export async function generateMetadata({ params }) {
|
|||
const data = await getData(params.id[0]);
|
||||
|
||||
const decodedName = decodeURIComponent(params.id[1]);
|
||||
|
||||
console.log("dddddd", data?.product);
|
||||
|
||||
const imageUrl = new URL(
|
||||
data?.product?.files && data?.product?.files[0].fileLocation,
|
||||
process.env.STORAGE_URL
|
||||
);
|
||||
console.log("dddddd", imageUrl);
|
||||
const metadataUrl = new URL(
|
||||
`products/${params.id[0]}/${decodedName}`,
|
||||
process.env.NEXT_PUBLIC_APP_URL
|
||||
);
|
||||
return {
|
||||
title: decodedName,
|
||||
description: ` خرید ${decodedName}| برندهای متنوع با پایین ترین قیمت | فروشگاه اینترنتی وسمه`,
|
||||
metadataBase: new URL(
|
||||
`https://www.vesmeh.com/categories/${params.id[0]}/${decodedName}`
|
||||
),
|
||||
metadataBase: metadataUrl,
|
||||
product_id_meta: data?.product?.id,
|
||||
keywords: [
|
||||
"آرایشی",
|
||||
|
@ -27,21 +31,13 @@ export async function generateMetadata({ params }) {
|
|||
"لوازم تمیزی",
|
||||
"مراقبت شخصی",
|
||||
],
|
||||
|
||||
openGraph: {
|
||||
title: decodedName,
|
||||
description: ` خرید ${decodedName}| برندهای متنوع با پایین ترین قیمت | فروشگاه اینترنتی وسمه`,
|
||||
// url: `https://www.vesmeh.com/categories/${params.id[0]}/${decodedName}`,
|
||||
images: [imageUrl],
|
||||
url: metadataUrl,
|
||||
type: "website",
|
||||
|
||||
images: [
|
||||
{
|
||||
url:
|
||||
process.env.NEXT_PUBLIC_STORAGE_URL + "/" + data?.product?.files &&
|
||||
data?.product?.files[0].fileLocation, // Dynamic og route
|
||||
width: 800,
|
||||
height: 600,
|
||||
},
|
||||
],
|
||||
locale: "en_US",
|
||||
type: "website",
|
||||
},
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
async function getData(id) {
|
||||
const res = await fetch(`https://storage.vesmeh.com/site-maps/site-map.xml`);
|
||||
const xml = await res.text();
|
||||
return xml;
|
||||
}
|
||||
|
||||
export default async function Sitemap() {
|
||||
const localUrl = [
|
||||
{
|
||||
url: "https://acme.com",
|
||||
lastModified: new Date(),
|
||||
changeFrequency: "yearly",
|
||||
priority: 1,
|
||||
},
|
||||
{
|
||||
url: "https://acme.com/about",
|
||||
lastModified: new Date(),
|
||||
changeFrequency: "monthly",
|
||||
priority: 0.8,
|
||||
},
|
||||
{
|
||||
url: "https://acme.com/blog",
|
||||
lastModified: new Date(),
|
||||
changeFrequency: "weekly",
|
||||
priority: 0.5,
|
||||
},
|
||||
];
|
||||
return (await getData()).concat(localUrl);
|
||||
}
|
Loading…
Reference in New Issue