diff --git a/.env.production b/.env.production index b514b4c..792357f 100644 --- a/.env.production +++ b/.env.production @@ -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 diff --git a/src/app/products/[...id]/page.jsx b/src/app/products/[...id]/page.jsx index 91fe2c8..004b818 100644 --- a/src/app/products/[...id]/page.jsx +++ b/src/app/products/[...id]/page.jsx @@ -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", }, diff --git a/src/app/sitemap.xml/page.jsx b/src/app/sitemap.xml/page.jsx new file mode 100644 index 0000000..ccf6997 --- /dev/null +++ b/src/app/sitemap.xml/page.jsx @@ -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); +}