75 lines
2.0 KiB
JavaScript
75 lines
2.0 KiB
JavaScript
import { MESHKEE_DOMAIN } from "../../meshkee.js";
|
|
import { SITE_ORIGIN } from "../../seo.js";
|
|
|
|
export const dynamic = "force-static";
|
|
|
|
const generatedAt = new Date().toISOString();
|
|
|
|
const staticRoutes = [
|
|
{ path: "/", priority: 1, changeFrequency: "daily" },
|
|
{ path: "/store", priority: 0.9, changeFrequency: "daily" },
|
|
{ path: "/blog", priority: 0.8, changeFrequency: "weekly" },
|
|
{ path: "/about-us", priority: 0.6, changeFrequency: "monthly" },
|
|
{ path: "/contact-us", priority: 0.6, changeFrequency: "monthly" }
|
|
];
|
|
|
|
const excludedPathPrefixes = [
|
|
"/admin",
|
|
"/auth",
|
|
"/cart",
|
|
"/checkout",
|
|
"/dashboard",
|
|
"/profile"
|
|
];
|
|
|
|
export async function GET() {
|
|
const body = {
|
|
domain: MESHKEE_DOMAIN,
|
|
origin: SITE_ORIGIN,
|
|
generatedAt,
|
|
sitemapIndex: {
|
|
enabled: true,
|
|
url: `${SITE_ORIGIN}/sitemap.xml`,
|
|
children: [
|
|
`${SITE_ORIGIN}/sitemap-main.xml`,
|
|
`${SITE_ORIGIN}/sitemap-products.xml`
|
|
]
|
|
},
|
|
staticRoutes: staticRoutes.map((route) => ({
|
|
...route,
|
|
url: `${SITE_ORIGIN}${route.path}`
|
|
})),
|
|
exclude: excludedPathPrefixes,
|
|
canonicalTemplates: {
|
|
product: {
|
|
path: "/products/{id}/{nameFaSlug}",
|
|
source: `/tenants/${MESHKEE_DOMAIN}/products/by-id/{id}`
|
|
},
|
|
category: {
|
|
path: "/products/category/{id}/{nameFaSlug}",
|
|
source: `/tenants/${MESHKEE_DOMAIN}/categories/by-id/{id}`,
|
|
listSource: `/tenants/${MESHKEE_DOMAIN}/products?categoryId={id}`
|
|
},
|
|
blog: {
|
|
path: "/blog/{id}/{titleSlug}",
|
|
source: `/tenants/${MESHKEE_DOMAIN}/blogs/by-id/{id}`
|
|
},
|
|
portfolio: {
|
|
path: "/portfolios/{id}/{titleFaSlug}",
|
|
source: `/tenants/${MESHKEE_DOMAIN}/portfolios/by-id/{id}`
|
|
}
|
|
},
|
|
slugRules: {
|
|
keepPersianLetters: true,
|
|
spaces: "-",
|
|
strip: "punctuation"
|
|
}
|
|
};
|
|
|
|
return Response.json(body, {
|
|
headers: {
|
|
"Cache-Control": "public, max-age=300, stale-while-revalidate=3600"
|
|
}
|
|
});
|
|
}
|