如何在不访问的情况下设置打开图默认图像

发布于 2024-12-22 18:38:12 字数 116 浏览 4 评论 0原文

我有一个网站,我可以在页面上修改/添加 html、PHP 和 JS 代码,但我无权访问 部分。

如何为打开的图表设置默认图像,以便在 Facebook 上共享页面时正确显示?

I have a website on which I can modify/add html, PHP, and JS code on the page but I do not have access to the <head></head> section.

How can I set a default image for open graph so that it shows correctly when the page is being shared on Facebook?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

明月松间行 2024-12-29 18:38:12

linter (https://developers.facebook.com/tools/debug) 只喜欢在 HTML 部分中看到 og: 标签。

“您的 之外还有标签。这可能是因为
你的格式错误,它们在解析树中的位置较低,或者
您不小心将开放图谱标签放在了错误的位置。任何一个
在标签可用之前您需要修复它。”

我什至尝试使用 javascript 以编程方式将它们放入 HEAD 的 DOM 中,但 linter 似乎没有运行脚本。它似乎正在查找所以我的建议是寻找更好的托管解决方案,尝试一下 GoDaddy.com 的托管包价格。更好:)

The linter (https://developers.facebook.com/tools/debug) only likes to see the og: tags in the section of the HTML.

"You have tags ouside of your . This is either because
your was malformed and they fell lower in the parse tree, or
you accidentally put your Open Graph tags in the wrong place. Either
way you need to fix it before the tags are usable."

I've even tried to put them into the DOM of the HEAD programmatically using javascript, but the linter doesn't appear to run the script. It appears to be looking in the originally downloaded HTML. So my advice is to look around for a better hosting solution. Try GoDaddy.com for some awesome pricing on hosting packages. You will need to gain access to the HEAD section and if you control the files, you'll be better off :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文