feat: 关于本站对齐站点公告,增加全部与管理入口

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-18 01:47:39 +08:00
parent 184489bca2
commit 2ccfb5f330
15 changed files with 384 additions and 80 deletions

View File

@@ -1,5 +1,9 @@
import type { MetadataRoute } from "next";
import { fetchPosts, fetchAnnouncementsPage, fetchOverview } from "@/lib/api";
import {
fetchPosts,
fetchAnnouncementsPage,
fetchPublishedSitePages,
} from "@/lib/api";
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const baseUrl = "http://localhost:3000";
@@ -11,6 +15,12 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
changeFrequency: "daily",
priority: 0.7,
},
{
url: `${baseUrl}/about`,
lastModified: new Date(),
changeFrequency: "monthly",
priority: 0.6,
},
];
try {
@@ -41,13 +51,12 @@ export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
/* 忽略 */
}
// 公开单页列表 API 尚未提供:用 overview 侧栏页近似收录已发布且展示中的页面
try {
const overview = await fetchOverview();
for (const p of overview.sidebar_pages ?? []) {
const { pages } = await fetchPublishedSitePages();
for (const p of pages) {
entries.push({
url: `${baseUrl}/p/${p.slug}`,
lastModified: new Date(),
lastModified: new Date(p.updated_at || p.created_at),
changeFrequency: "monthly",
priority: 0.4,
});