Skip to content

Commit c1cb8ab

Browse files
ericyangpanclaude
andcommitted
refactor(metadata): centralize metadata generation with new templates and improved path handling
- Add generateStaticPageMetadata() for generic pages - Improve path normalization in buildCanonicalUrl() and buildLanguageAlternates() - Update all generators to use createPageMetadata() template - Move FaqItem type definition to generated metadata file - Fix canonical URL building to use alternates.canonical throughout 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 263c98a commit c1cb8ab

File tree

5 files changed

+192
-66
lines changed

5 files changed

+192
-66
lines changed

scripts/generate/generate-metadata.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,14 @@ function main() {
389389
const content = `${header}
390390
391391
import type { CollectionSection } from '../collections'
392-
import type { FaqItem } from '../faq'
393392
import type { ArticleMetadata } from './articles'
394393
import type { DocSection } from './docs'
395394
395+
export type FaqItem = {
396+
title: string
397+
content: string
398+
}
399+
396400
export const articlesMetadata: Record<string, ArticleMetadata[]> = ${formatObject(articles)}
397401
398402
export const docsMetadata: Record<string, DocSection[]> = ${formatObject(docs)}

src/lib/generated/metadata.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
// DO NOT EDIT MANUALLY
33

44
import type { CollectionSection } from '../collections'
5-
import type { FaqItem } from '../faq'
65
import type { ArticleMetadata } from './articles'
76
import type { DocSection } from './docs'
87

8+
export type FaqItem = {
9+
title: string
10+
content: string
11+
}
12+
913
export const articlesMetadata: Record<string, ArticleMetadata[]> = {
1014
en: [
1115
{

0 commit comments

Comments
 (0)