summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-10-30 10:20:56 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-10-30 10:20:56 +0700
commitd3fa5fde0643375b72ca5650d7b00b8d74848942 (patch)
tree16d563b231fe5df39b8b636dbaa61dc69ed1550d /src
parent88bfcdafd22b8b2895529741b515d35f8478d127 (diff)
<MIqdad> change date xml
Diffstat (limited to 'src')
-rw-r--r--src/pages/sitemap/categories.xml.js47
1 files changed, 24 insertions, 23 deletions
diff --git a/src/pages/sitemap/categories.xml.js b/src/pages/sitemap/categories.xml.js
index 1c684576..357a2072 100644
--- a/src/pages/sitemap/categories.xml.js
+++ b/src/pages/sitemap/categories.xml.js
@@ -1,41 +1,42 @@
-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 categories = await odooApi('GET', '/api/v1/category/tree')
+ const categories = await odooApi('GET', '/api/v1/category/tree');
const sitemap = create('urlset', { encoding: 'utf-8' }).att(
'xmlns',
'http://www.sitemaps.org/schemas/sitemap/0.9'
- )
+ );
categories.forEach((category) => {
- addUrlToSitemap(sitemap, category.name, category.id)
+ addUrlToSitemap(sitemap, category.name, category.id);
category.childs.forEach((child1Category) => {
- addUrlToSitemap(sitemap, child1Category.name, child1Category.id)
+ addUrlToSitemap(sitemap, child1Category.name, child1Category.id);
child1Category.childs.forEach((child2Category) => {
- addUrlToSitemap(sitemap, child2Category.name, child2Category.id)
- })
- })
- })
+ addUrlToSitemap(sitemap, child2Category.name, child2Category.id);
+ });
+ });
+ });
- 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: {} };
}
function addUrlToSitemap(sitemap, name, id) {
- const baseUrl = process.env.SELF_HOST + '/shop/category/'
- const date = new Date()
- const url = sitemap.ele('url')
- url.ele('loc', createSlug(baseUrl, name, id))
- url.ele('lastmod', date.toISOString().slice(0, 10))
- url.ele('changefreq', 'weekly')
- url.ele('priority', '0.6')
+ const baseUrl = process.env.SELF_HOST + '/shop/category/';
+ // const date = new Date()
+ const date = '2025-10-30';
+ const url = sitemap.ele('url');
+ url.ele('loc', createSlug(baseUrl, name, id));
+ url.ele('lastmod', date);
+ url.ele('changefreq', 'weekly');
+ url.ele('priority', '0.6');
}
export default function SitemapProducts() {
- return null
+ return null;
}