Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【链接预览】博文链接在推特没有生成预览 #2513

Open
snape2019 opened this issue Jun 19, 2024 · 6 comments
Open

【链接预览】博文链接在推特没有生成预览 #2513

snape2019 opened this issue Jun 19, 2024 · 6 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed resolved

Comments

@snape2019
Copy link

snape2019 commented Jun 19, 2024

描述bug

分享博文的链接到推特之后,只有一个链接,而不是生成一个预览卡片。
image

期望的正常结果

应该生成类似下图的预览
image

复现步骤

只要是博客的链接都无法预览
环境

  • 【必填】NotionNext版本 [4.4.6]
  • 【必填】主题 [Next]
  • 【必填】部署方案 [vercel]
  • 【可选】操作系统: [iOS, Android, macOS, windows]
  • 【可选】浏览器 [chrome, brave]

补充说明

推特官方有个检测twitter card生成的网站 https://cards-dev.twitter.com/validator
我提交链接后结果如图
Card validator
出现了“no card found"的提示。
我看了这个帖子的回复,知道了要在标签添加相应属性,然后我发现notionnext原本就有Twitter card的内容,但是不知为何没有生效,尝试在components/Globalhead.js进行了修改,但是依然没有解决,以下是涉及Twitter card的部份:

<meta name='keywords' content={keywords} />
      <meta name='description' content={description} />
      <meta property='og:locale' content={lang} />
      <meta property='og:title' content={title} />
      <meta property='og:description' content={description} />
      <meta property='og:url' content={url} />
      <meta property='og:image' content={image} />
      <meta property='og:site_name' content={siteConfig('TITLE')} />
      <meta property='og:type' content={type} />
      <meta name='twitter:card' content='summary' />
      <meta name="twitter:site" content="@lmlovekpop" />
      <meta name='twitter:description' content={description} />
      <meta name='twitter:title' content={title} />

@snape2019 snape2019 added the bug Something isn't working label Jun 19, 2024
@tangly1024
Copy link
Owner

有些奇怪的bug,早先已经兼容了twitter的分享卡牌功能;我刚刚用演示网站测试了也是成功的。 但是用你的网站测试就无法通过,我需要找到这里有哪些差别,也许是域名、或者配置?

image
image

@tangly1024 tangly1024 added the help wanted Extra attention is needed label Jun 19, 2024
@snape2019
Copy link
Author

有些奇怪的bug,早先已经兼容了twitter的分享卡牌功能;我刚刚用演示网站测试了也是成功的。 但是用你的网站测试就无法通过,我需要找到这里有哪些差别,也许是域名、或者配置?

image image

需要提供信息呢?我的域名是在namesilo买的,用cloudflare解析dns,部署在vercel。可能是哪个环节出的问题呢?实在没有头绪。

@snape2019
Copy link
Author

snape2019 commented Jun 21, 2024

我想,我找到真正复现这个bug的机制了……notion config里面我指定了theme为next就会导致无法预览,只能在config.js和环境变量指定主题了。 @tangly1024

@snape2019
Copy link
Author

snape2019 commented Jun 21, 2024

image 不在notion config指定主题之后就可以正常生成Twitter card。

@tangly1024 tangly1024 changed the title 博文链接在推特没有生成预览 【链接预览】博文链接在推特没有生成预览 Jun 24, 2024
@gosber
Copy link

gosber commented Jun 25, 2024

kukasawa主题下也可以复现这个 bug,不在notion config中指定,而是在环境变量中指定就好了。
我嵌入的是tweet

@gosber
Copy link

gosber commented Jun 25, 2024

还是有问题的,在这个主题之下按这个方法好了一个 post,后续的 post 就报错了。
WX20240625-122549@2x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed resolved
Projects
None yet
Development

No branches or pull requests

3 participants