facebook 应用程序:如何放置像“a href”这样的 html 代码内部新闻提要内容? (最新api更新后)

发布于 2024-08-17 07:14:41 字数 499 浏览 2 评论 0原文

在最新的 Facebook 发布新闻提要更新后,它似乎不再支持新提要内容中的 html 代码(如 href),

但我仍然看到内容中带有可点击链接的提要,该怎么办?

下面是在提要内容中包含链接的提要图像


(来源:dchammer.com

After the newest Facebook update for publishing news feed, it seems that it doesn't support html code (like a href) inside the new feed content anymore

But I still see feeds with click-able link inside the content, how to do that?

below are the images of the feeds that have link inside the feed content


(source: dchammer.com)

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

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

发布评论

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

评论(3

2024-08-24 07:14:41

使用流附件对象的properties属性。这需要一个键/值对的字典,其中值本身可以是由文本和 href 属性组成的对象。例如,将类似以下内容的内容附加到 JavaScript 中的流附件对象上:

var properties = {
    "Rating" : {
        "text" : "1797 points",
        "href":"http://apps.facebook.com/yourappurl/"
        },
    "Leaderboard position":{
        "text":"192nd",
        "href":"http://apps.facebook.com/yourappurl/"
    }
}

将在单独的行上显示文本“评级:1797 分”和“排行榜位置:第 192 位”,其中“评级”和排行榜位置”文本为浅灰色,并且“1792 点”和“192nd”都是蓝色超链接。

“关键”部分(即“排行榜位置”部分)最多有 50 个字符,“值”部分最多有 70 个字符。

Use the properties property of the stream attachment object. This takes a dictionary of key/value pairs, where the values can themselves be an object consisting of text and href properties. E.g. attach something like the following onto your stream attachment object in JavaScript:

var properties = {
    "Rating" : {
        "text" : "1797 points",
        "href":"http://apps.facebook.com/yourappurl/"
        },
    "Leaderboard position":{
        "text":"192nd",
        "href":"http://apps.facebook.com/yourappurl/"
    }
}

Will display the text "Rating: 1797 points" and "Leaderboard position : 192nd" on separate lines, with the "Rating" and Leaderboard position" text in light grey and the "1792 points" and "192nd" both as blue hyperlinks.

There are character of 50 characters max for the "key" part (i.e. the "Leaderboard position" segment) and 70 characters for the "value" part.

能否归途做我良人 2024-08-24 07:14:41

所以我尝试了一个 href,而不是通常的 html,我做了一些试验和错误,发现如果这样写它就会工作:

a href=facebook.com facebook

关键是链接和要显示的实际文本之间的空格。如果没有空间,这将无法正常工作。

So I tried a href and instead of the usual html, I did some trial and error and found out it will work if written like this:

a href=facebook.com facebook

the key is the space between the link and the actual text you want to display. Without the space this won't work properly.

岁月如刀 2024-08-24 07:14:41

我相信这是由链接到的页面的元标记指定的。有关更多信息,请查看 http://wiki.developers.facebook.com/ index.php/Facebook_Share/Specifying_Meta_Tags

基本上,当用户发布到外部网站的链接时,Facebook 会获取该页面,并查看某些元标记以显示该网站的预览,包括一些文本和小图像(如果链接站点指定了这些图像)。

因此,我认为您应该能够在元描述中包含 href 标签,并且您应该已准备就绪。我还没有尝试过使用链接,但这绝对是显示描述和图像的方法。

I believe this is specified by the meta tags of the page being linked to. For more information, check out http://wiki.developers.facebook.com/index.php/Facebook_Share/Specifying_Meta_Tags

Basically, when the user posts a link to an outside site, facebook fetches that page, and looks at certain meta tags to come up with a preview of the site, including some text and a small image, if these are specified by the linked site.

So, I think you should be able to just include your href tags in your meta description, and you should be all set. I haven't tried this with links, but that is definitely how you get the description and image to show up.

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