完成站点地图的配置

This commit is contained in:
hejin 2025-08-04 23:38:09 +08:00
parent 6bbe8a4487
commit f07b1d5d11

View File

@ -80,7 +80,7 @@ export default {
icons: false icons: false
}, },
sitemap: { sitemap: {
hostname: 'http://114.132.197.85:8099', hostname: 'http://www.lighting-it.cn',
sitemaps: [ sitemaps: [
{ {
path: '/sitemap.xml', path: '/sitemap.xml',
@ -89,6 +89,7 @@ export default {
'/products.xml', '/products.xml',
'/inquiry.xml', '/inquiry.xml',
'/article-page.xml', '/article-page.xml',
'/separate.xml'
], ],
gzip: true gzip: true
}, },
@ -99,17 +100,59 @@ export default {
{ {
path: '/products.xml', path: '/products.xml',
routes: async () => { routes: async () => {
const { data: res} = await axios.get('http://114.132.197.85:8099/web/prodPageList?pageNum=1&pageSize=9&catgId=43bb1e22091c0f674453c8db7e89b4a3&tenantId=main') const { data: res} = await axios.get('http://114.132.197.85:8099/web/siteMap?catgType=cp&tenantId=main')
return res.data.records.map(item => { return res.data.map(item => {
return { return {
url: `/products/${item.id}`, url: `/products/${item.id}?catgId=${item.id}&maxCatgId=${item.maxCatgId}`,
changefreq: 'daily', changefreq: 'daily',
priority: 1 priority: 1
} }
}) })
}, },
gzip: true gzip: true
},
{
path: '/inquiry.xml',
routes: async () => {
const { data: res} = await axios.get('http://114.132.197.85:8099/web/siteMap?catgType=xp&tenantId=main')
return res.data.map(item => {
return {
url: `/inquiry?maxCatgId=${item.maxCatgId}?title=${item.title}`,
changefreq: 'daily',
priority: 1
} }
})
},
gzip: true
},
{
path: '/article-page.xml',
routes: async () => {
const { data: res} = await axios.get('http://114.132.197.85:8099/web/siteMap?catgType=wz&tenantId=main')
return res.data.map(item => {
return {
url: `/article-page/${item.id}?catgId=${item.id}&maxCatgId=${item.maxCatgId}`,
changefreq: 'daily',
priority: 1
}
})
},
gzip: true
},
{
path: '/inquiry.xml',
routes: async () => {
const { data: res} = await axios.get('http://114.132.197.85:8099/web/siteMap?catgType=dym&tenantId=main')
return res.data.map(item => {
return {
url: `/separate?maxCatgId=${item.maxCatgId}?title=${item.title}`,
changefreq: 'daily',
priority: 1
}
})
},
gzip: true
},
] ]
}, },
router: { router: {