getGuidesStaticProps() — supabase Function Reference
Architecture documentation for the getGuidesStaticProps() function in docs.ts from the supabase codebase.
Entity Profile
Dependency Diagram
graph TD 56466678_bf1f_b88a_2f2d_ad073243b70d["getGuidesStaticProps()"] 1ed78735_5e48_6f4d_c7c0_7d9f2c098ee4["isValidGuideFrontmatter()"] 56466678_bf1f_b88a_2f2d_ad073243b70d -->|calls| 1ed78735_5e48_6f4d_c7c0_7d9f2c098ee4 style 56466678_bf1f_b88a_2f2d_ad073243b70d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/docs/lib/docs.ts lines 93–144
export async function getGuidesStaticProps(
section: string,
{ params }: { params?: { slug?: string | Array<string> } }
) {
let relPath: string
switch (typeof params?.slug) {
case 'string':
relPath = section + sep + params.slug
break
case 'object': // actually an array
relPath = section + sep + params.slug.join(sep)
break
case 'undefined':
relPath = section
}
const fullPath = join(GUIDES_DIRECTORY, relPath + '.mdx')
/**
* SAFETY CHECK:
* Prevent accessing anything outside of GUIDES_DIRECTORY
*/
if (!fullPath.startsWith(GUIDES_DIRECTORY)) {
throw Error('Accessing forbidden route. Content must be within the GUIDES_DIRECTORY.')
}
const mdx = await readFile(fullPath, 'utf-8')
const editLink = `supabase/supabase/blob/master/apps/docs/content/guides/${relPath}.mdx`
const { data: frontmatter, content } = matter(mdx)
if (!isValidGuideFrontmatter(frontmatter)) {
// Will have thrown
return
}
const mdxOptions: SerializeOptions = {
mdxOptions: {
useDynamicImport: true,
remarkPlugins: [[remarkMath, { singleDollarTextMath: false }], remarkGfm],
rehypePlugins: [rehypeKatex as any],
},
}
const mdxSource = await serialize(content, mdxOptions)
return {
props: {
frontmatter,
mdxSource,
editLink,
},
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does getGuidesStaticProps() do?
getGuidesStaticProps() is a function in the supabase codebase.
What does getGuidesStaticProps() call?
getGuidesStaticProps() calls 1 function(s): isValidGuideFrontmatter.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free