feat: 关于本站对齐站点公告,增加全部与管理入口
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -124,6 +124,16 @@ export interface SidebarPageItem {
|
||||
excerpt: string;
|
||||
}
|
||||
|
||||
/** 公开单页目录(/about 全部页) */
|
||||
export interface SitePageSummary {
|
||||
id: number;
|
||||
slug: string;
|
||||
title: string;
|
||||
excerpt: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface SitePage {
|
||||
id: number;
|
||||
slug: string;
|
||||
@@ -1680,6 +1690,14 @@ export async function apiTimelineFromGit(input: {
|
||||
return data as { items: TimelineGitItem[]; warning?: string; error?: string };
|
||||
}
|
||||
|
||||
/** SSR / 公开:已发布单页目录 */
|
||||
export async function fetchPublishedSitePages(): Promise<{ pages: SitePageSummary[] }> {
|
||||
const res = await fetch(`${API_BASE}/api/pages`, ssrInit());
|
||||
const data = await res.json().catch(() => ({}));
|
||||
if (!res.ok) throw new Error(data.error || "获取页面失败");
|
||||
return { pages: data.pages ?? [] };
|
||||
}
|
||||
|
||||
export async function fetchSitePageBySlug(
|
||||
slug: string
|
||||
): Promise<{ page: SitePage } | null> {
|
||||
|
||||
Reference in New Issue
Block a user