From 2704993f278b4a24c4cf959bbb7a8f2ddd731e98 Mon Sep 17 00:00:00 2001 From: qianmoQ Date: Sun, 29 Dec 2024 20:57:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=B8=B2=E6=9F=93=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E7=9B=AE=E5=BD=95=E4=B8=8B=E9=9D=99=E6=80=81=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/content/docs/create-site/index.md | 2 +- docs/pageforge.yaml | 4 ++-- lib/site-generator.js | 10 ++++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/content/docs/create-site/index.md b/docs/content/docs/create-site/index.md index 186fa92..701b1d2 100644 --- a/docs/content/docs/create-site/index.md +++ b/docs/content/docs/create-site/index.md @@ -58,6 +58,6 @@ PageForge 包括一个实时预览服务器,因此您可以在编写文档时 pageforge serve ``` -将浏览器指向 [localhost:3000](http://localhost:3000),您应该会看到: +将浏览器指向 [localhost:3000](http://localhost:3000 "localhost:3000" "_blank"),您应该会看到: ![img.png](img.png) diff --git a/docs/pageforge.yaml b/docs/pageforge.yaml index 4a6b877..57a8fd3 100644 --- a/docs/pageforge.yaml +++ b/docs/pageforge.yaml @@ -30,6 +30,6 @@ nav: sidebar: default: - text: 快速上手 - link: '/docs/get-started' + link: /docs/get-started - text: 创建你的网站 - link: '/docs/create-site/index' \ No newline at end of file + link: /docs/create-site/index \ No newline at end of file diff --git a/lib/site-generator.js b/lib/site-generator.js index e64b4bf..2207bd5 100644 --- a/lib/site-generator.js +++ b/lib/site-generator.js @@ -136,6 +136,16 @@ class SiteGenerator { console.error(`✗ 编译 ${relativePath} 失败 ${error.message}`); } } + else { + // 复制非 Markdown 文件到对应输出目录 + const outputDir = path.join(this.config.outputPath, baseDir); + if (!fs.existsSync(outputDir)) { + fs.mkdirSync(outputDir, {recursive: true}); + } + const outputPath = path.join(outputDir, file); + fs.copyFileSync(sourcePath, outputPath); + console.log(`✓ 复制 ${relativePath} 文件完成`); + } } }