后台单页和公告改为正文优先编辑,保存与发布分开。

列表按列对照真实路径和状态,避免把 /p/ 前缀和发布操作混在一起。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-20 01:07:21 +08:00
parent 40bbad2c82
commit 803b694659
15 changed files with 1611 additions and 473 deletions

View File

@@ -0,0 +1,13 @@
/** 单页公开路径。前台路由是 /p/[slug],列表、复制和线上查看必须用同一条。 */
export function sitePagePublicPath(slug: string): string {
const clean = slug.trim();
if (!clean) return "/p/";
return `/p/${encodeURIComponent(clean)}`;
}
/** 用当前页面的 origin 拼绝对地址,不写死域名。origin 为空时只返回路径。 */
export function sitePagePublicURL(origin: string, slug: string): string {
const path = sitePagePublicPath(slug);
const base = origin.replace(/\/$/, "");
return base ? `${base}${path}` : path;
}