feat: 可配置站点 URL 风格
- 新增 urlStyle 工具与测试:postPath/userPath/sitePagePath 统一生成链接 - 管理端新增 UrlStylePanel 设置面板,settings 服务与 handler 适配 - 全站路由链接与 JSON-LD/sitemap 切换为统一 URL 生成 - middleware 与相关组件适配
This commit is contained in:
@@ -42,9 +42,11 @@ import {
|
||||
} from "@/lib/api";
|
||||
import { canModerateAuthor } from "@/lib/roles";
|
||||
import { formatRelative } from "@/lib/format";
|
||||
import { postPath } from "@/lib/urlStyle";
|
||||
import { toast } from "@/lib/toast";
|
||||
import { realtime, RT_MODERATION_CHANGED } from "@/lib/realtime";
|
||||
import Avatar from "@/components/Avatar";
|
||||
import { useUrlStyle } from "@/components/SiteBrandProvider";
|
||||
import AutolinkText from "@/components/AutolinkText";
|
||||
import ConfirmDialog from "@/components/ConfirmDialog";
|
||||
import StaffDeletePostModal from "@/components/StaffDeletePostModal";
|
||||
@@ -278,6 +280,7 @@ export default function ContentAdmin({
|
||||
canPurge: boolean;
|
||||
viewerRole: string;
|
||||
}) {
|
||||
const urlStyle = useUrlStyle();
|
||||
// 窄屏分段:lg 以下只显示一栏;PC 双栏同时可见
|
||||
const [mobileKind, setMobileKind] = useState<ContentKind>(initialKind);
|
||||
const [counts, setCounts] = useState(initialCounts);
|
||||
@@ -549,7 +552,7 @@ export default function ContentAdmin({
|
||||
</p>
|
||||
) : (
|
||||
<Link
|
||||
href={`/post/${p.id}`}
|
||||
href={postPath(urlStyle, p.id)}
|
||||
className="mt-1 block text-[13px] font-medium leading-snug hover:underline line-clamp-2"
|
||||
style={{ color: "var(--ink)" }}
|
||||
data-tip={p.title}
|
||||
@@ -689,7 +692,7 @@ export default function ContentAdmin({
|
||||
c.post_title
|
||||
) : (
|
||||
<Link
|
||||
href={`/post/${c.post_id}#comment-${c.id}`}
|
||||
href={`${postPath(urlStyle, c.post_id)}#comment-${c.id}`}
|
||||
className="hover:underline"
|
||||
style={{ color: "var(--accent)" }}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user