Skip to content

Commit 85e52e5

Browse files
committed
添加站点地图文档
1 parent 310e613 commit 85e52e5

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

docs/content/setup/sitemap.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: 站点地图
3+
icon: map
4+
---
5+
6+
PageForge 支持站点地图,可以帮助你快速找到你的网站。默认是禁用的,需要在 `pageforge.yaml` 配置文件中启用。
7+
8+
## 启用站点地图
9+
10+
---
11+
12+
```yaml
13+
feature:
14+
sitemap:
15+
enable: true
16+
```
17+
18+
> 启用站点地图后,将在底部出现站点地图链接。
19+
20+
!!! danger "注意"
21+
22+
启用站点地图,必须要在 `pageforge.yaml` 文件中添加以下配置
23+
24+
```yaml
25+
site:
26+
baseUrl: https://pageforge.devlive.org
27+
```
28+
29+
!!!

docs/pageforge.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ nav:
128128
- /setup/i18n
129129
- /setup/compress
130130
- /setup/share
131+
- /setup/sitemap
131132
- InlineTemplate:
132133
- /setup/template/home
133134
- /setup/template/enterprise

lib/file-processor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ class FileProcessor {
316316
let html = await this.templateEngine.renderWithLayout('layouts/page', pageData);
317317

318318
// 压缩 HTML
319-
if (this.config.feature?.compress?.enable !== false) {
319+
if (this.config.feature?.compress?.enable) {
320320
try {
321321
html = minify(html, this.minifyOptions);
322322
console.log(`🗜️ 压缩 ${relativePath} HTML 完成`);

templates/includes/footer.ejs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
alt="<%= siteData.site.title %>"
1111
class="h-12">
1212
</a>
13-
<a href="<%= pageData.language ? `/${pageData.language}` : '/' %>" class="text-xl font-bold text-gray-900 dark:text-white hover:text-gray-700 dark:hover:text-gray-200 transition-colors">
13+
<a href="<%= pageData.language ? `/${pageData.language}` : '/' %>"
14+
class="text-xl font-bold text-gray-900 dark:text-white hover:text-gray-700 dark:hover:text-gray-200 transition-colors">
1415
<%= !siteData.site.hiddenTitle ? siteData.site.title : '' %>
1516
</a>
1617
</div>
@@ -53,6 +54,10 @@
5354
<div class="flex flex-col items-center sm:flex-row sm:items-center justify-between gap-4">
5455
<span class="text-sm text-gray-500 dark:text-gray-400">
5556
<%= locals.siteData?.footer?.copyright %> 使用 ❤️ <a href="https://pageforge.devlive.org" class="hover:text-blue-600" target="_blank">PageForge</a> 构建
57+
58+
<% if (locals.siteData?.feature?.sitemap?.enable) { %>
59+
<a href="/sitemap.xml" target="_blank" class="ml-3 dark:hover:text-white hover:underline hover:text-blue-600">站点地图</a>
60+
<% } %>
5661
</span>
5762
5863
<% if (locals.siteData?.footer?.social) { %>

0 commit comments

Comments
 (0)