Total Pageviews

Tuesday, 19 November 2024

搭建基于 nextjs的静态博客程序 mdblog-public

先在windows桌面系统上安装nodejs环境。然后,

git clone https://github.com/Jihillestad/mdblog-public

cd mdblog-public

pnpm install

pnpm build (此即生成/更新静态网站的根目录的命令)

find . -name index.html

显示:

 ./.next/server/app/index.html

cd  ./.next/server/app/

~/mdblog-public/.next/server/app$ ls
_not-found/      about.rsc            favicon.ico.body  icon1.png.meta            page.js
_not-found.html  api/                 favicon.ico.meta  index.html                page.js.nft.json
_not-found.meta  apple-icon.png/      icon.png/         index.meta                page_client-reference-manifest.js
_not-found.rsc   apple-icon.png.body  icon.png.body     index.rsc                 tags/
about/           apple-icon.png.meta  icon.png.meta     opengraph-image.png/      tags.html
about.html       blog/                icon1.png/        opengraph-image.png.body  tags.meta
about.meta       favicon.ico/         icon1.png.body    opengraph-image.png.meta  tags.rsc

~/mdblog-public/.next/server/app$

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

新建源帖:

 cd ~/mdblog-public/

cd content/blog

nano pg.mdx

cat pg.mdx

显示:

---
title: 美丽的草原,我的家
description: 这是一首歌
date: 2024-11-19 09:06
published: true
tags: ["music", "life"]
--- 

此处写正文或html codes.

cd ~/mdblog-public/ 

$ pnpm build

演示网站:

https://jade-valkyrie-01404c.netlify.app/

https://mbp-kcfoqtwgz-luckypoems-projects.vercel.app/ 

(netlify.com空间比vercel.com空间更好用。

https://jade-valkyrie-01404c.netlify.app/blog/ce和https://jade-valkyrie-01404c.netlify.app/blog/ce.html都能正常显示网页. 但是,

https://mbp-kcfoqtwgz-luckypoems-projects.vercel.app/blog/ce却不能正常显示网页,一定要手工加上.html才行: https://mbp-kcfoqtwgz-luckypoems-projects.vercel.app/blog/ce.html )

项目地址:https://github.com/Jihillestad/mdblog-public

 

 

 


 


 



No comments:

Post a Comment