diff --git a/web/pages/index.tsx b/web/pages/index.tsx index aa9d84c7..66b68474 100644 --- a/web/pages/index.tsx +++ b/web/pages/index.tsx @@ -70,7 +70,7 @@ export default function Index({ documents, searchIndex }: IndexProps) { key={document.filePath} as={`/documents/${document.filePath.replace(/\.mdx?$/, '')}`} href={`/documents/[slug]`} - title={document.data.title} + title={document.data.title ?? 'Untitled'} desc={document.data.description} /> ))} diff --git a/web/utils/mdx-utils.ts b/web/utils/mdx-utils.ts index 140c22b6..89c76772 100644 --- a/web/utils/mdx-utils.ts +++ b/web/utils/mdx-utils.ts @@ -16,9 +16,15 @@ export const documentFilePaths = fs // Only include md(x) files .filter((path) => /\.mdx?$/.test(path)) +export interface DocumentData { + title?: string + description?: string + indexWeight?: number +} + export interface Document { content: string - data: object + data: DocumentData filePath: string }