docs: add blog post for v1

This commit is contained in:
Timothy Lin
2021-05-26 20:11:55 +08:00
parent 900669acfd
commit 670522ebe5
4 changed files with 86 additions and 19 deletions

View File

@ -1,6 +1,8 @@
import { MDXLayoutRenderer } from '@/components/MDXComponents'
import { getFileBySlug } from '@/lib/mdx'
const DEFAULT_LAYOUT = 'AuthorLayout'
export async function getStaticProps() {
const authorDetails = await getFileBySlug('authors', ['default'])
return { props: { authorDetails } }
@ -11,7 +13,7 @@ export default function About({ authorDetails }) {
return (
<MDXLayoutRenderer
layout={frontMatter.layout || 'AuthorLayout'}
layout={frontMatter.layout || DEFAULT_LAYOUT}
mdxSource={mdxSource}
frontMatter={frontMatter}
/>

View File

@ -4,6 +4,8 @@ import generateRss from '@/lib/generate-rss'
import { MDXLayoutRenderer } from '@/components/MDXComponents'
import { formatSlug, getAllFilesFrontMatter, getFileBySlug, getFiles } from '@/lib/mdx'
const DEFAULT_LAYOUT = 'PostLayout'
export async function getStaticPaths() {
const posts = getFiles('blog')
return {
@ -43,7 +45,7 @@ export default function Blog({ post, authorDetails, prev, next }) {
<>
{frontMatter.draft !== true ? (
<MDXLayoutRenderer
layout={frontMatter.layout || 'PostLayout'}
layout={frontMatter.layout || DEFAULT_LAYOUT}
mdxSource={mdxSource}
frontMatter={frontMatter}
authorDetails={authorDetails}