You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

为何我的网站链接在Discord中无法显示OG嵌入卡片?

Discord OG嵌入卡片失效排查与修复方案

问题背景

此前分享snoopti.de链接到Discord时会显示包含名称、图片的完整OG嵌入卡片,近期仅显示纯文本链接,嵌入功能失效。


核心修复步骤

1. 补全关键OG元标签

Discord的链接爬虫依赖完整的Open Graph标签,你的代码缺少两个必填项:

  • og:type:指定内容类型,首页需设为website
  • og:url:页面的完整绝对URL,帮助爬虫确认唯一地址

修改index.php的<head>区域,添加以下标签:

<meta property="og:type" content="website" />
<meta property="og:url" content="https://snoopti.de/" />

2. 修正OG图片为绝对URL

当前og:image使用相对路径,部分爬虫无法正确解析,改为完整地址:

<!-- 原代码 -->
<meta property="og:image" content="/assets/bilder/og/main.png" />
<!-- 修改后 -->
<meta property="og:image" content="https://snoopti.de/assets/bilder/og/main.png" />

3. 清理重复的元标签

代码中重复定义了X-UA-Compatible标签,保留兼容现代浏览器的版本即可,删除旧的IE=7条目:

<!-- 删除这一行 -->
<meta http-equiv="X-UA-Compatible" content="IE=7" />

4. 强制Discord刷新缓存

Discord会缓存旧的OG数据,修复后需强制刷新:

  • 在链接末尾加随机参数,比如发送https://snoopti.de/?refresh=1
  • 右键Discord中的旧链接,选择「复制链接」后重新发送

5. 验证基础可访问性

确认以下内容正常:

  • 网站robots.txt未禁止爬虫访问
  • main.png图片存在且可直接打开,文件大小不超过5MB
  • 页面返回200正常状态码,无加载错误

修复后的OG标签参考

<!-- ---------- ALLGEMEIN -->
<title>Home | snoopti.de</title>
<meta property="og:site_name" content="snoopti.de" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://snoopti.de/" />
<meta property="og:title" content="Home | snoopti.de" />
<meta name="description" content="Herzlich Willkommen auf meiner Webseite!" />
<meta property="og:description" content="Herzlich Willkommen auf meiner Webseite!" />
<meta property="og:image" content="https://snoopti.de/assets/bilder/og/main.png" />
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="1000" />
<meta property="og:image:height" content="1000" />

内容的提问来源于stack exchange,提问作者snoopti

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 05:50:54