Total Pageviews

Thursday, 5 December 2024

搭建基于nextjs的静态博客程序 blog-by-coderPerseus

 先安装nodejs环境和pnpm.

git clone https://github.com/coderPerseus/blog blog-by-coderPerseus

cd blog-by-coderPerseus

pnpm install

pnpm build

(如果此步遇到错误,请看build 失败 · Issue #30 · coderPerseus/blog

这一步运行后,会在当前目录下,生成out/目录,

cd out

$ ls

404.html          about.txt                            feed.xml   index.html  og.png      posts.txt      site.webmanifest  test.txt

_next/            apple-icon.jpg                       icon.html  index.txt   police.png  projects.html  sitemap.xml

about-me-bg.webp  baidu_verify_codeva-7AmpPWgzQY.html  icon.jpg   logo.png    posts/      projects.txt   style/

about.html        favicon.ico                          icon.txt   logo.webp   posts.html  robots.txt     test.html

~/blog-by-coderPerseus/out (main)$
( 可见~/blog-by-coderPerseus/out 就是静态网站的根目录)

新建源帖:
$ cd ../posts
$ nano pg.mdx
$ cat pg.mdx
显示:
---
title: 美丽的草原,我的家
description: 这是一首歌
tags: [music, life, culture]
slug: pg
author: brite
date: 2024-12-05 0:08
---

此处写正文或html codes.

cd ..
~/blog-by-coderPerseus (main)$ pnpm build

演示网站:
https://earnest-capybara-6d5d5a.netlify.app/posts
https://tranquil-daffodil-78f5cd.netlify.app/posts

项目地址:https://github.com/coderPerseus/blog





No comments:

Post a Comment