Files
supabase/apps/docs/lib/docs.ts
T
Charis e20038e2f2 refactor: move auth guides into content directory (#20777)
Begin the process of moving our MDX files into their own content directory.

Fixed a few minor bugs re: ToC and tabs not rerendering consistently on page navigation. (The ToC thing wasn't a problem before the refactor, the tabs thing is a problem on prod.)

Moved MDX files can't import their own components, so everything they require needs to be back in the component prop for mdx-remote's serializer. Cleaned this up a bit and lazy-loaded heavy/rare stuff. Also, the component prop doesn't take arbitrary objects (only actual components), so imported data has to be wrapped in a component.
2024-02-07 17:25:08 +00:00

18 lines
573 B
TypeScript

import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
export const DOCS_DIRECTORY = join(dirname(fileURLToPath(import.meta.url)), '..')
export const GUIDES_DIRECTORY = join(DOCS_DIRECTORY, 'content/guides')
type GuideFrontmatter = {
title: string
description?: string
hideToc?: boolean
}
export function isValidGuideFrontmatter(obj: object): obj is GuideFrontmatter {
if (!('title' in obj) || typeof obj.title !== 'string') return false
if ('description' in obj && typeof obj.description !== 'string') return false
return true
}