hulai-website/server/routes/sitemap.xml.js
刘涛 a25f3a77ce sync: 同步最新呼籁官网代码到仓库
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-22 21:57:35 +08:00

180 行
6.2 KiB
JavaScript

export default defineEventHandler((event) => {
const pages = [
{
url: '/', priority: '1.0', changefreq: 'weekly',
images: [{ loc: '/images/team/hero-grassland.jpg', title: '呼伦贝尔草原风光 - 呼籁旅行' }],
},
{
url: '/faq', priority: '0.95', changefreq: 'weekly',
images: [{ loc: '/images/team/hero-grassland.jpg', title: '呼伦贝尔草原 - 呼籁旅行常见问答' }],
},
{
url: '/products', priority: '0.9', changefreq: 'weekly',
images: [{ loc: '/images/mascot/xiaomengma.png', title: '小蒙马夏令营IP形象' }],
},
{
url: '/about', priority: '0.85', changefreq: 'monthly',
images: [
{ loc: '/images/team/hero-family.jpg', title: '呼伦贝尔家庭游合影' },
{ loc: '/images/team/guide-group.jpg', title: '呼籁旅行领队团队合影' },
{ loc: '/images/mascot/mascot-front.png', title: '呼籁旅行吉祥物' },
],
},
{
url: '/reviews', priority: '0.8', changefreq: 'weekly',
images: [
{ loc: '/images/reviews/review-001.jpg', title: '呼籁旅行客户好评截图' },
{ loc: '/images/reviews/review-002.jpg', title: '呼伦贝尔亲子游客户评价' },
],
},
{
url: '/contact', priority: '0.8', changefreq: 'monthly',
images: [{ loc: '/images/contact/qrcode-wechat.jpg', title: '呼籁旅行微信客服二维码' }],
},
{
url: '/pricing', priority: '0.9', changefreq: 'monthly',
images: [{ loc: '/images/mascot/mascot-front.png', title: '呼籁旅行 额吉的故乡V9系列定制游价格参考' }],
},
{
url: '/selector', priority: '0.85', changefreq: 'monthly',
images: [],
},
{
url: '/guides', priority: '0.8', changefreq: 'monthly',
images: [],
},
{
url: '/news', priority: '0.85', changefreq: 'weekly',
images: [],
},
{
url: '/calendar', priority: '0.85', changefreq: 'monthly',
images: [],
},
{
url: '/courses', priority: '0.85', changefreq: 'monthly',
images: [],
},
{
url: '/summer-camp', priority: '0.85', changefreq: 'monthly',
images: [
{ loc: '/images/summer-camp/river-banner.jpg', title: '小蒙马夏令营河畔活动' },
{ loc: '/images/summer-camp/grassland-group.jpg', title: '草原亲子夏令营合影' },
{ loc: '/images/summer-camp/birch-group.jpg', title: '白桦林研学活动' },
{ loc: '/images/summer-camp/camp-graduation.jpg', title: '夏令营结营仪式' },
],
},
]
// 目的地页面
pages.push({
url: '/destinations', priority: '0.9', changefreq: 'weekly',
images: [],
})
const destinationIds = [
'moriguole', 'eergunashire', 'heishantou', 'manzhouli',
'hulunhu', 'aershan', 'shiwei', 'genhe',
]
for (const id of destinationIds) {
pages.push({
url: `/destinations/${id}`, priority: '0.85', changefreq: 'monthly',
images: [],
})
}
// 博客攻略页面
const blogArticles = [
'hulunbuir-travel-guide-2026',
'hulunbuir-family-travel-guide',
'hulunbuir-best-month-to-visit',
'hulunbuir-self-drive-vs-chartered-bus',
'hulunbuir-travel-cost-breakdown',
'hulunbuir-travel-with-toddlers-4-6',
'hulunbuir-travel-tips-avoid-pitfalls',
'grassland-photography-outfit-guide',
]
pages.push({ url: '/blog', priority: '0.85', changefreq: 'weekly', images: [] })
for (const id of blogArticles) {
pages.push({ url: `/blog/${id}`, priority: '0.8', changefreq: 'monthly', images: [] })
}
// 旅拍作品展示页
pages.push({
url: '/gallery',
priority: '0.85',
changefreq: 'monthly',
images: [
{ loc: '/images/gallery/gallery-001.jpg', title: '莫日格勒河畔蒙古袍亲子旅拍' },
{ loc: '/images/gallery/gallery-002.jpg', title: '额尔古纳湿地情侣旅拍' },
{ loc: '/images/gallery/gallery-003.jpg', title: '白桦林间闺蜜写真' },
{ loc: '/images/gallery/gallery-004.jpg', title: '黑山头草原全家福' },
],
})
// 攻略指南详情页
pages.push({ url: '/guide-custom', priority: '0.8', changefreq: 'monthly', images: [] })
// 冬季营
pages.push({ url: '/winter-camp', priority: '0.85', changefreq: 'monthly', images: [] })
// 在线定制表单
pages.push({ url: '/customize', priority: '0.9', changefreq: 'monthly', images: [] })
// 信任度页面
pages.push({
url: '/stories', priority: '0.85', changefreq: 'weekly',
images: [{ loc: '/images/team/hero-family.jpg', title: '呼籁旅行真实客户故事 - 家庭呼伦贝尔旅行记录' }],
})
const storyIds = [
'story-3',
'story-4',
'story-5',
'story-6',
'story-7',
]
for (const id of storyIds) {
pages.push({ url: `/stories/${id}`, priority: '0.8', changefreq: 'monthly', images: [] })
}
// 产品独立页面(与 data/products.json versions 对齐)
const productVersions = [
{ id: 'v9-4d3n', name: '呼伦贝尔4天3晚精华版亲子游' },
{ id: 'v9-5d4n', name: '呼伦贝尔5天4晚经典版亲子游' },
{ id: 'v9-6d5n-family', name: '呼伦贝尔6天5晚亲子版亲子游' },
{ id: 'v9-6d5n-comfort', name: '呼伦贝尔6天5晚舒适版亲子游' },
{ id: 'v9-7d6n-family', name: '呼伦贝尔7天6晚亲子版亲子游' },
{ id: 'v9-7d6n-wild', name: '呼伦贝尔7天6晚旷野版亲子游' },
]
for (const v of productVersions) {
pages.push({
url: `/products/${v.id}`, priority: '0.85', changefreq: 'monthly',
images: [],
})
}
const today = new Date().toISOString().split('T')[0]
const base = 'https://1814.love'
const xml = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
${pages
.map(
(p) => ` <url>
<loc>${base}${p.url}</loc>
<lastmod>${today}</lastmod>
<changefreq>${p.changefreq}</changefreq>
<priority>${p.priority}</priority>${p.images.map(img => `
<image:image>
<image:loc>${base}${img.loc}</image:loc>
<image:title>${img.title}</image:title>
</image:image>`).join('')}
</url>`
)
.join('\n')}
</urlset>`
setResponseHeader(event, 'content-type', 'application/xml')
return xml
})