Files
blog/content/posts/link-cards-test.md
T
wait4xandGLM-5.3 f5232b7c03 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
2026-11-02 12:46:26 +08:00

31 lines
856 B
Markdown

---
title: "链接卡片样例"
pubDate: 2026-11-02
category: tech
tags: [test, hidden]
# 链接卡片(OG 预览)测试样张:hidden 不列出,构建验证用;保留为活样例
draft: false
---
本篇验证链接卡片:独立成段的裸链接转 OG 预览卡,内联链接保持普通样式。
## 正例:有 OG 的站点
https://wait4x.online/
https://astro.build/
## 反例:404 与无 OG 站点(应回落普通链接,构建不报错)
https://wait4x.online/definitely-not-a-real-page-404/
https://example.com/
## 内联链接保持普通样式(不应变卡)
这里有一个内联链接 [Astro 官网](https://astro.build/) 夹在句子中间,它必须保持普通链接样式,不能整篇变卡片墙。
## 卡片首行文字(markdown 链接形态同样触发)
[wait4x.online 首页](https://wait4x.online/)