blob: 3c7f1ade9511bf05c9ffe77481ff72e2e3c8d59c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
import { create } from 'xmlbuilder';
import { createSlug } from '@/core/utils/slug';
import odooApi from '@/core/api/odooApi';
export async function getServerSideProps({ res }) {
const baseUrl = process.env.SELF_HOST + '/shop/brands/';
const brands = await odooApi('GET', `/api/v1/manufacture?limit=0`);
const sitemap = create('urlset', { encoding: 'utf-8' }).att(
'xmlns',
'http://www.sitemaps.org/schemas/sitemap/0.9'
);
const date = new Date();
// const date = '2025-10-30';
brands.manufactures.forEach((brand) => {
const url = sitemap.ele('url');
url.ele('loc', createSlug(baseUrl, brand.name, brand.id));
url.ele('lastmod', date);
url.ele('changefreq', 'daily');
url.ele('priority', '1.0');
});
res.setHeader('Content-Type', 'text/xml');
res.write(sitemap.end());
res.end();
return { props: {} };
}
export default function SitemapProducts() {
return null;
}
|