diff options
Diffstat (limited to 'src/pages/sitemap/brands.xml.js')
| -rw-r--r-- | src/pages/sitemap/brands.xml.js | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/src/pages/sitemap/brands.xml.js b/src/pages/sitemap/brands.xml.js index 65a84e97..c2199d85 100644 --- a/src/pages/sitemap/brands.xml.js +++ b/src/pages/sitemap/brands.xml.js @@ -1,31 +1,32 @@ -import { create } from 'xmlbuilder' -import { createSlug } from '@/core/utils/slug' -import odooApi from '@/core/api/odooApi' +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 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 = 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.toISOString().slice(0, 10)) - url.ele('changefreq', 'daily') - url.ele('priority', '1.0') - }) + 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() + res.setHeader('Content-Type', 'text/xml'); + res.write(sitemap.end()); + res.end(); - return { props: {} } + return { props: {} }; } export default function SitemapProducts() { - return null + return null; } |
