diff --git a/packages/commons/app-utils/src/mdx.ts b/packages/commons/app-utils/src/mdx.ts index 17437202d8..9bff652ffc 100644 --- a/packages/commons/app-utils/src/mdx.ts +++ b/packages/commons/app-utils/src/mdx.ts @@ -4,13 +4,20 @@ import remarkGfm from "remark-gfm"; const REMARK_PLUGINS = [remarkGfm]; +export interface FernDocsFrontmatter { + title?: string; + description?: string; + editThisPageUrl?: string; + image?: string; +} + export interface TableOfContentsItem { // heading: marked.Tokens.Heading | undefined; simpleString: string; children: TableOfContentsItem[]; } -export type SerializedMdxContent = MDXRemoteSerializeResult, Record>; +export type SerializedMdxContent = MDXRemoteSerializeResult, FernDocsFrontmatter>; /** * Should only be invoked server-side. @@ -27,6 +34,6 @@ export async function serializeMdxContent(content: string): Promise = ({ resolvedPath }) => { + const editThisPage = resolvedPath.serializedMdxContent.frontmatter.editThisPageUrl ?? resolvedPath?.editThisPageUrl; return (
@@ -43,9 +44,9 @@ export const CustomDocsPage: React.FC = ({ resolvedPath })