我是如何搭建这个博客的

May-26, 2024 · 3min

change language

详细介绍如何从零开始搭建一个基于 Next.js 和 MDX 的静态博客,包括组件开发、PWA 配置、Open Graph 图片生成等技术细节

Note

这篇文章已经过时了,请参考 使用 FumaDocs 重构这个博客

信息

组件

图片

可以直接在相对路径下引入图片,使用 remark-static-image 插件,自动导入图片,具体可以查看 Next.js 中使用 MDX 静态图片

GitHub Alert

> [!NOTE]  
> Highlights information that users should take into account, even when skimming.

> [!TIP]  
> Optional information to help a user be more successful.

> [!IMPORTANT]  
> Crucial information necessary for users to succeed.

> [!WARNING]  
> Critical content demanding immediate user attention due to potential risks.

> [!CAUTION]  
> Negative potential consequences of an action.

Note

Highlights information that users should take into account, even when skimming.

Tip

Optional information to help a user be more successful.

Important

Crucial information necessary for users to succeed.

Warning

Critical content demanding immediate user attention due to potential risks.

Caution

Negative potential consequences of an action.

PWA

添加 OG 图片

Changelog

升级 tailwindcss v4

https://github.com/Debbl/aiwan.run/pull/19

添加 OG 图片

https://github.com/Debbl/aiwan.run/pull/14

添加 GitHub Alert

https://github.com/Debbl/aiwan.run/commit/c9cb8268eb2037bec897ffbdeb780135d2145039

添加 NProgress

https://github.com/Debbl/aiwan.run/pull/12

refactor use mdx

https://github.com/Debbl/aiwan.run/pull/11

  • 使用 mdx 重构了博客 nextjs文档
  • 参考了 nextra 的实现
  • 使用 app router 作为 page 加载 mdx 文件
  • remark-mdx-layout 全局的 Layout 组件
  • remark-static-image 相对路径引入静态图片文件