12345678910111213141516171819202122232425262728293031323334353637383940 |
- import process from 'node:process'
- import axios from 'axios'
- const BASE_URL = process.env.NODE_ENV === 'production'
- ? 'https://www.ejetselection.com'
- : 'http://localhost:8000'
- export const sitemapConfig = {
- hostname: BASE_URL,
- // 静态路由
- staticRoutes: [
- {
- loc: '/',
- changefreq: 'daily',
- priority: 1,
- },
- ],
- // 动态路由生成函数
- async generateDynamicRoutes() {
- const routes: any[] = []
- try {
- // 获取品牌列表
- // const { data: brandData }: any = await axios.get(`${BASE_URL}/client/brand/list/default`, { params: { pageSize: 10000, pageNo: 1 } })
- // if (brandData.code === 200) {
- // brandData.result.records.forEach((brand: any) => {
- // routes.push({
- // loc: `${BASE_URL}/brand/${brand.id}`,
- // changefreq: 'weekly',
- // priority: 0.7,
- // })
- // })
- // }
- }
- catch (error) {
- console.error('Error fetching brands:', error)
- }
- return routes
- },
- }
|