From 82d4ed44791950c190ba9f9faefba592c24f1d0c Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Thu, 22 Feb 2024 18:50:41 -0500 Subject: [PATCH] Do this less dirty --- web/pages/index.tsx | 2 +- web/utils/mdx-utils.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) 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 }