Merge branch 'feat/docs2.0' of https://github.com/supabase/supabase into feat/docs2.0

This commit is contained in:
Jonathan Summers-Muir
2022-12-08 23:54:37 +08:00
3 changed files with 16 additions and 82 deletions

View File

@@ -196,11 +196,22 @@ const SiteRefLayout = ({ children }) => {
<div className="flex flex-row gap-3 mt-6">
<span className="text-xs text-scale-900">Supabase 2022</span>
<span className="text-xs text-scale-900"></span>
<a className="text-xs text-scale-800">Contributing</a>
<a className="text-xs text-scale-800">Author Styleguide</a>
<a className="text-xs text-scale-800">Changelog</a>
<a className="text-xs text-scale-800">Opensource</a>
<a className="text-xs text-scale-800">Supasquad</a>
<Link href="/handbook/contributing">
<a className="text-xs text-scale-800 hover:underline">Contributing</a>
</Link>
<Link href="https://supabase.com/changelog">
<a className="text-xs text-scale-800 hover:underline">Changelog</a>
</Link>
<Link href="https://github.com/supabase/supabase/blob/master/DEVELOPERS.md">
<a className="text-xs text-scale-800 hover:underline">Author Styleguide</a>
</Link>
<Link href="https://supabase.com/docs/oss">
<a className="text-xs text-scale-800 hover:underline">Open Source</a>
</Link>
<Link href="https://supabase.com/docs/handbook/supasquad">
<a className="text-xs text-scale-800 hover:underline">Supasquad</a>
</Link>
</div>
</div>

View File

@@ -1,13 +0,0 @@
import Layout from '~/layouts/DefaultGuideLayout'
export const meta = {
id: '404',
title: '404 not found',
description: '404 not found',
}
404 not found
export const Page = ({ children }) => <Layout meta={meta} children={children} />
export default Page

View File

@@ -1,64 +0,0 @@
import toc from 'markdown-toc'
import { MDXRemote } from 'next-mdx-remote'
import { serialize } from 'next-mdx-remote/serialize'
import components from '../components/index'
import Layout from '~/layouts/Default'
import { getAllDocs, getDocsBySlug } from '../lib/docs'
interface Meta {
id: string
title: string
sidebar_label: string
hide_table_of_contents: boolean
}
interface Props {
meta: Meta
content: any
toc: any
}
export default function Doc({ meta, content, toc }: Props) {
return (
// @ts-ignore
<Layout meta={meta} toc={toc}>
<MDXRemote {...content} components={components} />
</Layout>
)
}
export async function getStaticProps({ params }: { params: { slug: string[] } }) {
let slug
if (params.slug.length > 1) {
slug = `docs/${params.slug.join('/')}`
} else {
slug = `docs/${params.slug[0]}`
}
let doc = getDocsBySlug(slug)
const content = await serialize(doc.content || '')
return {
props: {
...doc,
content,
toc: toc(doc.content, { maxdepth: 1, firsth1: false }),
},
}
}
export function getStaticPaths() {
let docs = getAllDocs()
return {
paths: docs.map(() => {
return {
params: {
slug: docs.map((d) => d.slug),
},
}
}),
fallback: 'blocking',
}
}