fix(products): add externalUrl support for standalone products and fix footer alignment
- Add externalUrl field to standalone product content type - Filter out externalUrl products from generateStaticParams - Fix email icon vertical alignment in footer
This commit is contained in:
@@ -8,7 +8,10 @@ export const revalidate = 3600;
|
||||
|
||||
export async function generateStaticParams() {
|
||||
const items = await getPublishedItems('standalone-product');
|
||||
return items.map((item) => ({ id: item.slug! }));
|
||||
// 排除有 externalUrl 的产品(它们会跳转到外部域名,无需生成静态页面)
|
||||
return items
|
||||
.filter((item) => !item.data.externalUrl)
|
||||
.map((item) => ({ id: item.slug! }));
|
||||
}
|
||||
|
||||
export async function generateMetadata({ params }: { params: Promise<{ id: string }> }): Promise<Metadata> {
|
||||
|
||||
@@ -76,8 +76,8 @@ export function Footer() {
|
||||
<MapPin className="w-4 h-4 text-gray-400 mt-0.5 shrink-0" />
|
||||
<span className="text-gray-300 text-sm leading-relaxed">{config.address}</span>
|
||||
</li>
|
||||
<li className="flex items-center gap-3">
|
||||
<Mail className="w-4 h-4 text-gray-400 shrink-0" />
|
||||
<li className="flex items-start gap-3">
|
||||
<Mail className="w-4 h-4 text-gray-400 mt-0.5 shrink-0" />
|
||||
<a
|
||||
href={`mailto:${config.email}`}
|
||||
className="text-gray-300 hover:text-white transition-colors duration-200 text-sm"
|
||||
|
||||
@@ -453,6 +453,12 @@ const standaloneProductFields: FieldDefinition[] = [
|
||||
label: '产品图片',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'externalUrl',
|
||||
type: 'text',
|
||||
label: '外部跳转链接',
|
||||
description: '若设置,访问该产品详情页时将跳转到此 URL(如独立子域名产品)',
|
||||
},
|
||||
{
|
||||
name: 'category',
|
||||
type: 'text',
|
||||
|
||||
Reference in New Issue
Block a user