Total Pageviews

Thursday, 24 October 2024

搭建next.js portofolio blog

 npm install -g pnpm

$ pnpm create next-app --example https://github.com/vercel/examples/tree/main/solutions/blog nab-blog

(此命令会在当前目录下,生成 nab-blog目录)
显示:
...
Success! Created blog at C:\Users\12799\nab-blog
Inside that directory, you can run several commands:

$ cd nab-blog
$ pnpm build

($ pnpm start
    Runs the built app in production mode.)

$ find . -name index.html
./.next/server/app/index.html

(可见,~/nab-blog/.next/server/app/就是静态网站的根目录)

新建源帖:

cd  app/blog/posts 

nano happy-festival.mdx

cat  happy-festival.mdx

显示:

---
title: '快乐的节日'
publishedAt: '2024-10-31T10:00:00'
summary: '这是一首歌'

---

此处写正文或html codes.

$  cd ~/nab-blog/

$ pnpm build

演示网站:https://incomparable-hotteok-4c485d.netlify.app/

项目地址:https://github.com/vercel/next.js/tree/canary/packages/create-next-app
ref: https://vercel.com/templates/next.js/portfolio-starter-kit

https://nextjs.org/docs/app/building-your-application/deploying

(源帖-mdx文件的格式问题:

https://mdxjs.com/docs/troubleshooting-mdx/)

No comments:

Post a Comment