Next js(即OpenGraph)中存在Whatsapp共享url问题,使用动态数据时无法在whatsapp中显示或获取数据

发布于 2025-01-20 10:09:14 字数 1348 浏览 2 评论 0原文

当我在_app.js中使用元og标签时,用静态内容进行工作时, whatsapp共享

_app.js

<Head>
    <meta name="viewport" content="initial-scale=1, width=device-width" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <meta name="viewport" content="user-scalable=no" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
    />
    <meta name="HandheldFriendly" content="true" />
    <meta property="og:title" content="The Rock" />
    <meta property="og:type" content="video.movie" />
    <meta property="og:url" content={"https://connectme.co.in"} />
    <meta property="og:image" content={"https://images.wsj.net/im-515021?width=860&height=573"} />
  </Head>

但是,当我在索引等其他页面上使用它时,它在 中没有显示任何内容 它不起作用

index.js

<Head>
    <meta property="og:title" content={profileData?.name} />
    <meta property="og:image" content={profileData?.profileimg} />
    <meta property="og:type" content="profile.image" />
    <meta property="og:url" content={"https://connectme.co.in/"} />
  </Head>

profiledata是纽约动态数据,

现在它在这里不起作用, 当我在Facebook调试器中检查时,它显示了这一

推论的属性 即使可以从其他标签中推断出值,也应明确提供“ OG:Image”属性。

When I am using meta og tags in _app.js its work with static content,
but when I use it on other pages like index , its not showing anything in whatsapp sharing

_app.js

<Head>
    <meta name="viewport" content="initial-scale=1, width=device-width" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <meta name="viewport" content="user-scalable=no" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
    />
    <meta name="HandheldFriendly" content="true" />
    <meta property="og:title" content="The Rock" />
    <meta property="og:type" content="video.movie" />
    <meta property="og:url" content={"https://connectme.co.in"} />
    <meta property="og:image" content={"https://images.wsj.net/im-515021?width=860&height=573"} />
  </Head>

its working here but in index page
its not working

index.js

<Head>
    <meta property="og:title" content={profileData?.name} />
    <meta property="og:image" content={profileData?.profileimg} />
    <meta property="og:type" content="profile.image" />
    <meta property="og:url" content={"https://connectme.co.in/"} />
  </Head>

profileData is ny dynamic data

now its not working here ,
when i Checked in facebook debugger its showing this

Inferred Property
The 'og:image' property should be explicitly provided, even if a value can be inferred from other tags.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文