feat(content): 链接卡片模式——独立成段裸链接转 OG 预览卡

- rehype-link-cards.ts 构建期插件:段落仅含一个链接才转卡(内联链接
  保持普通样式);fetch OG/twitter 元信息(UA 伪装、4s 超时、只读前
  200KB)+ favicon 兜底;任何失败回落普通链接,构建绝不因外部站点挂
- content/.link-cache.json 入仓缓存(30 天刷新,构建确定性与零重复
  请求);单篇上限 10 卡、并发 4,超出回落
- LinkCardStyles.astro 灰阶卡片样式:hairline+圆角、favicon 16px、
  标题一行/描述两行截断、域名 mono、OG 图右侧 88px(无图不占位)、
  hover 1px 微浮(reduced-motion 豁免)、纯 CSS 零 JS
- 安全:抓取内容全 escaping、图片地址仅 http(s)
- @astrojs/markdown-remark 依赖(Astro 7 换默认 markdown 处理器后
  自定义插件必须经此包生效)
- 样张 content/posts/link-cards-test.md(tags 含 hidden,活样例不列出)

修复说明:264148f 提交时误带入 archives 页面对 LinkCardStyles 的
import(两车道共改同一文件),本笔补全组件与插件,恢复构建仓可用。
教训:跨车道共改文件,staged 前必须看 diff 归属。

车道:op-artalk;收编复验:本地构建 45 页 + 卡片渲染(后续专项复验)

验证: pnpm astro build 45 页 exit 0;link-cards 样张页渲染正常

Spec: none (链接卡片,车道级交付)

Co-authored-by: GLM-5.3
This commit is contained in:
wait4xandGLM-5.3 committed 2026-11-02 12:46:26 +08:00
1 parent 264148f0a6
commit f5232b7c03
7 files changed
+1701 -14

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
{
"_readme": "链接卡片抓取缓存(构建确定性需求,入仓)。键=URL,值={title,desc,image,favicon,ts};ts 超 30 天刷新。手工改动安全:删条目即下次构建重抓。",
"https://www.cnblogs.com/Lenbrother/p/18673403": {
"title": "Debian 安装 Docker - 神奇小宝 - 博客园",
"desc": "卸载已有 Docker 如果你之前安装过 Docker Engine 之前,你需要卸载旧版本,避免冲突: for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get rem",
"image": "https://assets.cnblogs.com/images/wechat-share.jpg",
"favicon": "https://assets.cnblogs.com/favicon_v3_3.ico",
"ts": 1793593758751
},
"https://wait4x.online/": {
"title": "wait4x",
"desc": "wait4x 的博客:阅读 · 技术 · 摄影",
"image": "",
"favicon": "https://wait4x.online/favicon.svg",
"ts": 1793593759184
},
"https://blog.csdn.net/qq_40605167/article/details/122888580": {
"title": "Docker版 E5续订的E5调用API续订服务:Microsoft 365 E5 Renew X_e5 docker",
"desc": "文章浏览阅读2.7w次,点赞10次,收藏43次。本文介绍了如何使用Docker轻松部署Microsoft365E5续订服务,包括提供小巧的镜像、一键部署命令及邮箱通知功能。用户需要具备Docker基础,并按照步骤修改邮箱和密码等参数。此外,还提供了不同CPU架构的支持。注意,已有部分账号出现被关停的情况。文章附带了Docker环境搭建教程和相关资源链接。",
"image": "https://i-blog.csdnimg.cn/blog_migrate/cover/dc9f6540d4d4330e797f1ebd0261f736.png",
"favicon": "https://g.csdnimg.cn/static/logo/favicon32.ico",
"ts": 1793593759739
},
"https://astro.build/": {
"title": "Astro",
"desc": "Astro builds fast content sites, powerful web applications, dynamic server APIs, and everything in-between.",
"image": "https://astro.build/og/astro.jpg",
"favicon": "https://astro.build/favicon.svg",
"ts": 1793593759816
}
}