Files
2026-10-08 11:09:37 +08:00

41 lines
1.1 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 文章领域类型。
*
* 数据源已从 `content/posts/*.mdx` 文件迁移到 PostgreSQL 的 `posts` 表。
* 为了不改动页面层与 MDX 渲染管线,这里保留了原有的字段命名
* (`date`、`draft` 等),由 `lib/posts/repository.ts` 负责
* 在数据库行与这些类型之间做映射。
*/
/** 文章的公共元信息 */
export interface PostFrontmatter {
/** 标题 */
title: string;
/** 发布日期,格式 YYYY-MM-DD */
date: string;
/** 摘要,用于卡片与 SEO description */
summary: string;
/** 标签 */
tags?: string[];
/** 是否为草稿;为 true 时不参与任何列表、详情与 sitemap 输出 */
draft?: boolean;
/** 封面图路径 */
cover?: string;
/** 覆盖默认 SEO 描述 */
description?: string;
}
/** 列表页使用的文章摘要信息(不含正文) */
export interface PostMeta extends PostFrontmatter {
/** URL 标识 */
slug: string;
/** 阅读时长(分钟,取整,最少 1) */
readingMinutes: number;
}
/** 详情页使用的完整文章 */
export interface Post extends PostMeta {
/** Markdown / MDX 正文(未编译) */
content: string;
}