Files
imen_pishghaman/server/routes/sitemap.xml.ts
T
s.esmaeiliandClaude Opus 4.6 bb7f1e3378 feat: update Dockerfile, add category pages, fonts and product images
Rebuild Docker setup with simplified nginx-only Dockerfile (build runs
on host). Add category detail pages, IRANSans font files, product
images, and update all landing sections.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-10-07 00:45:51 +03:30

25 lines
845 B
TypeScript

import { absUrl } from "../../shared/config/site";
import { categorySlugs } from "../../shared/data/categories";
interface SitemapEntry {
loc: string;
priority: string;
}
const pages: SitemapEntry[] = [
{ loc: "/", priority: "1" },
...categorySlugs.map((s) => ({ loc: `/categories/${s}`, priority: "0.8" })),
];
export default defineEventHandler((event) => {
setHeader(event, "Content-Type", "application/xml; charset=utf-8");
const lastmod = new Date().toISOString();
const urls = pages
.map(
(p) =>
`<url>\n<loc>${absUrl(p.loc)}</loc>\n<lastmod>${lastmod}</lastmod>\n<changefreq>monthly</changefreq>\n<priority>${p.priority}</priority>\n</url>`,
)
.join("\n");
return `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n${urls}\n</urlset>\n`;
});