Published on

使用 Next.js 搭建博客

Authors
  • avatar
    Name
    Jeffrey Wang
    Twitter

引言

原有的博客是部署在 Ghost 博客引擎上的。 博客源码位于 https://github.com/armyja/armyja-blog

Create a Next.js app

首先打开 nextjs 官网,学习创建一个初始应用 1

npx create-next-app nextjs-blog --use-npm --example "https://github.com/vercel/next-learn/tree/master/basics/learn-starter"

Run the development server

cd nextjs-blog

然后运行以下命令:

npm run dev

接下来是搬砖过程,为了熟悉 TypeScript 语法我将 https://github.com/timlrx/tailwind-nextjs-starter-blog 的 JS 版本(master)分支重写为 ts 版本。若要一键使用可选择下图的 typescript 分支。

https://tailwind-nextjs-starter-blog.vercel.app/

重写的过程也是梳理博客系统的过程,

https://www.geekinsta.com/how-to-export-ghost-posts-to-markdown/

Footnotes

  1. create-nextjs-app/setup