Fix product URLs, prerender routes and links
Update routes and URL handling for product pages and improve prerender behavior. Changes include: - data/pricing.json: change summer camp URL to the canonical "/summer-camp" path. - nuxt.config.js: set prerender.failOnError = false and clean up the prerender routes list (replace old product slugs with new ones, remove duplicated entries, and consolidate gallery/news/calendar/stories routes). - pages/destinations/[id].vue: switch product links to use a productUrl helper and add mapping rules so autumn-*/winter-* IDs route to /products/autumn and /products/winter, and the summer-camp ID routes to /summer-camp. These changes align link generation with updated product routes and make prerendering more robust.
这个提交包含在:
父节点
a35eb22c58
当前提交
0f591eaf5b
@ -82,7 +82,7 @@
|
|||||||
"每期仅限8组家庭",
|
"每期仅限8组家庭",
|
||||||
"含爸妈托管时段"
|
"含爸妈托管时段"
|
||||||
],
|
],
|
||||||
"url": "/products/summer-camp"
|
"url": "/summer-camp"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "autumn",
|
"id": "autumn",
|
||||||
|
|||||||
@ -7,17 +7,15 @@ export default defineNuxtConfig({
|
|||||||
// 部署时使用 `nuxt build` + Node.js 服务器(如 PM2)。
|
// 部署时使用 `nuxt build` + Node.js 服务器(如 PM2)。
|
||||||
// 若必须静态部署,需将表单改为第三方服务(飞书/EmailJS 等)。
|
// 若必须静态部署,需将表单改为第三方服务(飞书/EmailJS 等)。
|
||||||
prerender: {
|
prerender: {
|
||||||
|
failOnError: false,
|
||||||
crawlLinks: true,
|
crawlLinks: true,
|
||||||
routes: [
|
routes: [
|
||||||
'/', '/about', '/products', '/summer-camp', '/winter-camp', '/courses', '/guides', '/guide-custom', '/faq', '/reviews', '/contact', '/customize', '/pricing', '/selector', '/sitemap.xml',
|
'/', '/about', '/products', '/summer-camp', '/winter-camp', '/courses', '/guides', '/guide-custom', '/faq', '/reviews', '/contact', '/customize', '/pricing', '/selector', '/sitemap.xml',
|
||||||
'/products/v9-4d3n', '/products/v9-5d4n', '/products/v9-6d5n-family',
|
'/products/v9-5d4n-forest', '/products/v9-5d4n-prairie',
|
||||||
'/products/v9-6d5n-comfort', '/products/v9-7d6n-family', '/products/v9-7d6n-wild',
|
'/products/v9-6d5n-family', '/products/v9-6d5n-explore',
|
||||||
|
'/products/v9-7d6n-family', '/products/v9-7d6n-wild',
|
||||||
'/products/autumn', '/products/winter',
|
'/products/autumn', '/products/winter',
|
||||||
'/gallery',
|
'/gallery', '/news', '/calendar', '/stories',
|
||||||
'/gallery',
|
|
||||||
'/news', '/calendar',
|
|
||||||
|
|
||||||
'/stories',
|
|
||||||
'/blog',
|
'/blog',
|
||||||
'/blog/hulunbuir-travel-guide-2026',
|
'/blog/hulunbuir-travel-guide-2026',
|
||||||
'/blog/hulunbuir-family-travel-guide',
|
'/blog/hulunbuir-family-travel-guide',
|
||||||
@ -30,28 +28,8 @@ export default defineNuxtConfig({
|
|||||||
'/destinations',
|
'/destinations',
|
||||||
'/destinations/moriguole', '/destinations/eergunashire', '/destinations/baihualin',
|
'/destinations/moriguole', '/destinations/eergunashire', '/destinations/baihualin',
|
||||||
'/destinations/enhe-shiwei', '/destinations/heishantou', '/destinations/manzhouli',
|
'/destinations/enhe-shiwei', '/destinations/heishantou', '/destinations/manzhouli',
|
||||||
'/destinations/hulunhu', '/destinations/aershan', '/destinations/shiwei',
|
'/destinations/hulunhu', '/destinations/aershan',
|
||||||
'/destinations/daxinganling', '/destinations/aoluguya', '/destinations/genhe',
|
'/destinations/daxinganling', '/destinations/aoluguya', '/destinations/genhe',
|
||||||
'/products/autumn', '/products/winter',
|
|
||||||
'/products/autumn', '/products/winter',
|
|
||||||
'/products/autumn', '/products/winter',
|
|
||||||
'/destinations',
|
|
||||||
'/destinations/moriguole', '/destinations/eergunashire', '/destinations/baihualin',
|
|
||||||
'/destinations/enhe-shiwei', '/destinations/heishantou', '/destinations/manzhouli',
|
|
||||||
'/destinations/hulunhu', '/destinations/aershan', '/destinations/shiwei',
|
|
||||||
'/destinations/daxinganling', '/destinations/aoluguya', '/destinations/genhe',
|
|
||||||
'/gallery',
|
|
||||||
'/news', '/calendar',
|
|
||||||
'/stories',
|
|
||||||
'/blog',
|
|
||||||
'/blog/hulunbuir-travel-guide-2026',
|
|
||||||
'/blog/hulunbuir-family-travel-guide',
|
|
||||||
'/blog/hulunbuir-best-month-to-visit',
|
|
||||||
'/blog/hulunbuir-self-drive-vs-chartered-bus',
|
|
||||||
'/blog/hulunbuir-travel-cost-breakdown',
|
|
||||||
'/blog/hulunbuir-travel-with-toddlers-4-6',
|
|
||||||
'/blog/hulunbuir-travel-tips-avoid-pitfalls',
|
|
||||||
'/blog/grassland-photography-outfit-guide',
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -62,7 +62,7 @@
|
|||||||
<NuxtLink
|
<NuxtLink
|
||||||
v-for="p in relatedProducts"
|
v-for="p in relatedProducts"
|
||||||
:key="p.id"
|
:key="p.id"
|
||||||
:to="`/products/${p.id}`"
|
:to="productUrl(p.id)"
|
||||||
class="product-link"
|
class="product-link"
|
||||||
>
|
>
|
||||||
<span class="product-name">{{ p.name }}</span>
|
<span class="product-name">{{ p.name }}</span>
|
||||||
@ -179,6 +179,13 @@ const relatedProducts = computed(() => (dest.value?.relatedProducts || [])
|
|||||||
.map(pid => allVersions.value.find(v => v.id === pid))
|
.map(pid => allVersions.value.find(v => v.id === pid))
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
function productUrl(id) {
|
||||||
|
if (id.startsWith('autumn-')) return '/products/autumn'
|
||||||
|
if (id.startsWith('winter-')) return '/products/winter'
|
||||||
|
if (id === 'summer-camp') return '/summer-camp'
|
||||||
|
return `/products/${id}`
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
正在加载...
x
在新工单中引用
屏蔽一个用户