diff --git a/docs/migrating/from-gatsby.md b/docs/migrating/from-gatsby.md index 2550ffc47f3a304a9648bf4377d5f6c0936eb5d7..79d59c6b1c2c7bf3b9fe5f5ac03149fb7986cba0 100644 --- a/docs/migrating/from-gatsby.md +++ b/docs/migrating/from-gatsby.md @@ -84,10 +84,10 @@ import { getPostBySlug, getAllPosts } from '../lib/blog' export async function getStaticProps({ params }) { const post = getPostBySlug(params.slug) - const content = await remark() + const markdown = await remark() .use(html) .process(post.content || '') - .toString() + const content = markdown.toString() return { props: { @@ -128,7 +128,7 @@ import { join } from 'path' const postsDirectory = join(process.cwd(), 'src', 'content', 'blog') export function getPostBySlug(slug) { - const realSlug = slug.replace(/\\.md$/, '') + const realSlug = slug.replace(/\.md$/, '') const fullPath = join(postsDirectory, `${realSlug}.md`) const fileContents = fs.readFileSync(fullPath, 'utf8') const { data, content } = matter(fileContents)