feat: 可配置站点 URL 风格
- 新增 urlStyle 工具与测试:postPath/userPath/sitePagePath 统一生成链接 - 管理端新增 UrlStylePanel 设置面板,settings 服务与 handler 适配 - 全站路由链接与 JSON-LD/sitemap 切换为统一 URL 生成 - middleware 与相关组件适配
This commit is contained in:
@@ -2,9 +2,11 @@ import Link from "next/link";
|
||||
import { Megaphone, Pin } from "lucide-react";
|
||||
import type { AnnouncementSummary } from "@/lib/api";
|
||||
import { formatShortDate } from "@/lib/format";
|
||||
import { getPublicSettingsCached } from "@/lib/serverData";
|
||||
import { announcementPath } from "@/lib/urlStyle";
|
||||
|
||||
/** 近期公告目录(高亮当前 id) */
|
||||
export default function SiteDocAnnoNav({
|
||||
export default async function SiteDocAnnoNav({
|
||||
items,
|
||||
currentId,
|
||||
showAllLink = true,
|
||||
@@ -13,6 +15,7 @@ export default function SiteDocAnnoNav({
|
||||
currentId?: number;
|
||||
showAllLink?: boolean;
|
||||
}) {
|
||||
const urlStyle = (await getPublicSettingsCached()).url_style;
|
||||
return (
|
||||
<section className="j13-module flex min-h-0 flex-col" aria-label="近期公告">
|
||||
<div className="flex items-center justify-between gap-2 shrink-0">
|
||||
@@ -37,7 +40,7 @@ export default function SiteDocAnnoNav({
|
||||
return (
|
||||
<li key={a.id}>
|
||||
<Link
|
||||
href={`/announcement/${a.id}`}
|
||||
href={announcementPath(urlStyle, a.id)}
|
||||
className="j13-anno-item"
|
||||
data-tip={a.title}
|
||||
aria-current={current ? "page" : undefined}
|
||||
|
||||
Reference in New Issue
Block a user