初始提交:时之刃的小站
基于 VermilionVoid(朱墨留白)主题的个人博客。 - 站点配置集中在 src/data/site.ts 与 src/data/profile.ts - 30 篇文章、8 条偶得、相册 - 评论使用自托管 twikoo - 部署走 deploy.sh(rsync 到树莓派 + 云服务器)
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 评论系统配置。
|
||||
*
|
||||
* 这里配置的是 twikoo(https://twikoo.js.org)。留空 twikooEnvId
|
||||
* 则整个评论区不渲染。
|
||||
*
|
||||
* 也可以用环境变量 PUBLIC_TWIKOO_ENV_ID 覆盖,优先级高于本文件。
|
||||
*/
|
||||
export const commentConfig = {
|
||||
/** twikoo 后端地址(部署 twikoo 的那个域名) */
|
||||
twikooEnvId: "https://twikoo.tianxuetao.top",
|
||||
|
||||
/** 评论界面语言 */
|
||||
lang: "zh-CN",
|
||||
|
||||
/** twikoo 前端脚本版本,从 jsDelivr 加载 */
|
||||
version: "1.7.4",
|
||||
|
||||
/**
|
||||
* 评论归属用的路径是否去掉结尾斜杠。
|
||||
* 本站 trailingSlash 为 "always",但评论 key 统一存成不带斜杠的
|
||||
* `/posts/xxx` 形式,与该路径在旧站点上的历史数据保持一致。
|
||||
*/
|
||||
stripTrailingSlash: true,
|
||||
} as const
|
||||
@@ -0,0 +1,47 @@
|
||||
export interface DisclaimerConfig {
|
||||
type: string;
|
||||
title: string;
|
||||
content: string;
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
export const disclaimers: Record<string, DisclaimerConfig> = {
|
||||
暴论: {
|
||||
type: "此即暴论",
|
||||
title: "此即暴论",
|
||||
content:
|
||||
"本文涉及可能引起争议的观点和话题,内容仅代表我发癫时的个人立场,有极大概率是不中肯、不客观、不完善的,不构成任何形式的建议或倡导。",
|
||||
icon: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3E%3Cpath d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"%3E%3C/path%3E%3Cpath d="M12 9v4"%3E%3C/path%3E%3Cpath d="m12 17 .01 0"%3E%3C/path%3E%3C/svg%3E',
|
||||
},
|
||||
免责声明: {
|
||||
type: "免责声明",
|
||||
title: "免责声明",
|
||||
content:
|
||||
"本文内容仅供参考,不构成任何形式的专业建议。作者对因使用本文信息而产生的任何后果不承担责任。",
|
||||
icon: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3E%3Ccircle cx="12" cy="12" r="10"%3E%3C/circle%3E%3Cpath d="M8 12h8"%3E%3C/path%3E%3C/svg%3E',
|
||||
},
|
||||
过时内容: {
|
||||
type: "过时内容",
|
||||
title: "内容时效性提醒",
|
||||
content:
|
||||
"本篇博客完成日期距现在已大于一年,内容可能已过时,相关技术、政策或情况可能已发生变化,建议读者查证最新信息。",
|
||||
icon: 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3E%3Ccircle cx="12" cy="12" r="10"%3E%3C/circle%3E%3Cpolyline points="12,6 12,12 16,14"%3E%3C/polyline%3E%3C/svg%3E',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据声明类型获取声明配置
|
||||
* @param types 声明类型数组或逗号分隔的字符串
|
||||
* @returns 声明配置数组
|
||||
*/
|
||||
export function getDisclaimers(types: string | string[]): DisclaimerConfig[] {
|
||||
if (!types) return [];
|
||||
|
||||
const typeArray = Array.isArray(types)
|
||||
? types
|
||||
: types.split(",").map((t) => t.trim());
|
||||
|
||||
return typeArray
|
||||
.filter((type) => disclaimers[type])
|
||||
.map((type) => disclaimers[type]);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* 相册配置。
|
||||
*
|
||||
* 每添加一个 albums 数组项就多一个相册,同时在 public/gallery/<id>/ 下
|
||||
* 放照片即可 —— 照片由构建时扫描目录得到,不需要在这里逐个列出。
|
||||
*
|
||||
* 封面优先级:cover 字段 > 目录里的 cover.* 文件 > 目录里第一张图
|
||||
*/
|
||||
|
||||
export type GalleryAlbum = {
|
||||
/** 相册唯一标识,同时是 public/gallery/ 下的目录名与 URL 路径 */
|
||||
id: string
|
||||
/** 相册名称 */
|
||||
name: string
|
||||
/** 相册描述 */
|
||||
description?: string
|
||||
/** 拍摄地点 */
|
||||
location?: string
|
||||
/** 日期,格式 YYYY-MM-DD,用于展示与排序 */
|
||||
date?: string
|
||||
/** 标签,用于索引页筛选 */
|
||||
tags?: string[]
|
||||
/** 手动指定封面(public 下的绝对路径)。不填则自动选取 */
|
||||
cover?: string
|
||||
}
|
||||
|
||||
export const galleryConfig: {
|
||||
albums: GalleryAlbum[]
|
||||
/** 瀑布流最小列宽(px),浏览器据此自动算列数 */
|
||||
columnWidth: number
|
||||
} = {
|
||||
albums: [
|
||||
{
|
||||
id: "GalleryFav",
|
||||
name: "喜欢的壁纸",
|
||||
description: "记录时光",
|
||||
location: "甘肃-张掖",
|
||||
date: "2026-07-18",
|
||||
tags: ["壁纸", "收藏"],
|
||||
},
|
||||
],
|
||||
|
||||
columnWidth: 240,
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
export type ExternalProfileLinkType = "qq" | "music" | "github" | "email"
|
||||
export type ProfileLinkType = ExternalProfileLinkType | "wechat"
|
||||
|
||||
export interface ExternalProfileLink {
|
||||
type: ExternalProfileLinkType
|
||||
name: string
|
||||
url: string
|
||||
}
|
||||
|
||||
export interface QrProfileLink {
|
||||
type: "wechat"
|
||||
name: string
|
||||
qrImage: string
|
||||
qrAlt: string
|
||||
label: string
|
||||
}
|
||||
|
||||
export type ProfileLink = ExternalProfileLink | QrProfileLink
|
||||
|
||||
/** 常用联系方式,改这里即可,下方 links 会引用它们 */
|
||||
const GITHUB_URL = "https://github.com/TimeCrackbot"
|
||||
const EMAIL = "tianxuetao1998@hotmail.com"
|
||||
|
||||
/**
|
||||
* 作者个人资料。站点级配置(站名、域名、描述)在 src/data/site.ts。
|
||||
*
|
||||
* links 支持的 type:github / email / qq / music / wechat。
|
||||
* wechat 类型走二维码弹层,需要额外提供 qrImage、qrAlt、label 三个字段。
|
||||
*/
|
||||
export const profile: {
|
||||
name: string
|
||||
bio: string
|
||||
avatar: string
|
||||
email: string
|
||||
links: ProfileLink[]
|
||||
} = {
|
||||
name: "时之刃",
|
||||
bio: "只是将博客作为新的爱好的普通人!",
|
||||
avatar: "/avatar.webp",
|
||||
email: EMAIL,
|
||||
links: [
|
||||
{
|
||||
type: "github",
|
||||
name: "GitHub",
|
||||
url: GITHUB_URL,
|
||||
},
|
||||
{
|
||||
type: "email",
|
||||
name: "Email",
|
||||
url: `mailto:${EMAIL}`,
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* 站点级配置 —— 站名、域名、描述、主题色等集中在这里。
|
||||
*
|
||||
* 改站名或域名时只需要改本文件:astro.config.mjs、各页面 <title>、
|
||||
* 页眉、页脚、RSS 都从这里取值。
|
||||
*
|
||||
* 作者个人资料(昵称、签名、头像、社交链接)在 src/data/profile.ts。
|
||||
*/
|
||||
|
||||
export const site = {
|
||||
/** 站点名称。用于页眉、页脚、<title> 后缀 */
|
||||
name: "时之刃的小站",
|
||||
|
||||
/**
|
||||
* 副标题。出现在首页 <title> 与首屏小字上。
|
||||
* 首屏是 0.4em 字距的排版,四五个字左右最好看;留空则 <title> 只有站名。
|
||||
*/
|
||||
tagline: "抵抗遗忘",
|
||||
|
||||
/** 站点 URL。不要带结尾斜杠,需与 astro.config.mjs 的 site 一致 */
|
||||
url: "https://tianxuetao.top",
|
||||
|
||||
/** 站点描述。用于 <meta name="description"> 与 RSS */
|
||||
description: "分享技术、编程、Linux、Obsidian等相关内容,提供教程和资源。",
|
||||
|
||||
/** 站点关键词 */
|
||||
keywords: ["技术", "博客", "编程", "Linux", "Obsidian", "教程"],
|
||||
|
||||
/** 站点语言,对应 <html lang> */
|
||||
lang: "zh-CN",
|
||||
|
||||
/** 建站日期,格式 YYYY-MM-DD */
|
||||
startDate: "2026-07-17",
|
||||
|
||||
/** 站点时区,IANA 时区字符串 */
|
||||
timezone: "Asia/Shanghai",
|
||||
|
||||
/** 主题色相,范围 0-360。红色 0、青色 200、蓝绿色 250、粉色 345 */
|
||||
themeHue: 25,
|
||||
} as const
|
||||
|
||||
/** 首页完整标题:站名 + 副标题(副标题留空时只有站名) */
|
||||
export const homeTitle = site.tagline ? `${site.name} | ${site.tagline}` : site.name
|
||||
|
||||
/** 内页标题后缀。用法:`${pageName} | ${siteTitleSuffix}` */
|
||||
export const siteTitleSuffix = site.name
|
||||
|
||||
/** 站点头像/站点图标的绝对地址,供友链页等对外展示用 */
|
||||
export const siteAvatarUrl = `${site.url}/avatar.webp`
|
||||
|
||||
/**
|
||||
* 统计分析。每一项留空即不加载对应的脚本。
|
||||
*/
|
||||
export const analytics = {
|
||||
/** Umami 网站 ID */
|
||||
umamiWebsiteId: "3cee1e39-a98a-4562-9669-f3bc28914140",
|
||||
/** Umami 脚本地址,自建或官方均可 */
|
||||
umamiScriptUrl: "https://umami.tianxuetao.top/script.js",
|
||||
/** Google Analytics 衡量 ID,形如 G-XXXXXXXXXX */
|
||||
googleAnalyticsId: "",
|
||||
/** Microsoft Clarity 项目 ID */
|
||||
clarityId: "",
|
||||
} as const
|
||||
|
||||
Reference in New Issue
Block a user