fix: fixed the problem of not rendering mdx article content properly
This commit is contained in:
parent
f708712a3b
commit
0cca11aec6
3 changed files with 10 additions and 5 deletions
|
|
@ -10,10 +10,6 @@ image:
|
||||||
tags: ["astro", "blogging", "learning-in-public"]
|
tags: ["astro", "blogging", "learning-in-public"]
|
||||||
---
|
---
|
||||||
|
|
||||||
# My First Blog Post
|
|
||||||
|
|
||||||
Published on: 2020-07-01
|
|
||||||
|
|
||||||
Welcome to my _new blog_ about learning Astro! Here, I will share my learning journey as I build a new website.
|
Welcome to my _new blog_ about learning Astro! Here, I will share my learning journey as I build a new website.
|
||||||
|
|
||||||
## What I've accomplished
|
## What I've accomplished
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,10 @@ image:
|
||||||
tags: ["astro", "博客", "公开学习"]
|
tags: ["astro", "博客", "公开学习"]
|
||||||
---
|
---
|
||||||
|
|
||||||
|
export const title = "mdx"
|
||||||
|
|
||||||
|
## {title}
|
||||||
|
|
||||||
欢迎来到我学习关于 Astro 的新博客!在这里,我将分享我建立新网站的学习历程。
|
欢迎来到我学习关于 Astro 的新博客!在这里,我将分享我建立新网站的学习历程。
|
||||||
|
|
||||||
## 我做了什么
|
## 我做了什么
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
---
|
---
|
||||||
|
import { render } from "astro:content"
|
||||||
import { langs } from "~/i18n/ui"
|
import { langs } from "~/i18n/ui"
|
||||||
import { getLangFromUrl } from "~/i18n/utils"
|
import { getLangFromUrl } from "~/i18n/utils"
|
||||||
import MainLayout from "~/layouts/main.astro"
|
import MainLayout from "~/layouts/main.astro"
|
||||||
|
|
@ -24,6 +25,8 @@ export async function getStaticPaths() {
|
||||||
const lang = getLangFromUrl(Astro.url)
|
const lang = getLangFromUrl(Astro.url)
|
||||||
|
|
||||||
const { post } = Astro.props
|
const { post } = Astro.props
|
||||||
|
|
||||||
|
const { Content } = await render(post)
|
||||||
---
|
---
|
||||||
|
|
||||||
<MainLayout {...post.data}>
|
<MainLayout {...post.data}>
|
||||||
|
|
@ -35,7 +38,9 @@ const { post } = Astro.props
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="my-6" set:html={post.rendered.html} />
|
<div class="my-6">
|
||||||
|
<Content />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="space-x-3 pb-10 text-sm text-gray-500">
|
<div class="space-x-3 pb-10 text-sm text-gray-500">
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue