在Facebook上发布PDF链接时如何获取元数据? [英] How to get metadata when posting link to PDF on facebook?

查看:159
本文介绍了在Facebook上发布PDF链接时如何获取元数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止,在我的研究中,似乎Facebook搜寻器不支持PDF文件. 共享指向PDF文件的链接时,没有可用的元数据. 这在打开图形对象调试器中很明显 在PDF文件中设置元数据没有任何影响.

So far in my research it appears that facebooks crawler doesn't support PDF files. When sharing a link to a PDF file, no metadata is available. This is apparent in the Open Graph Object Debugger Setting the metadata in the PDF file has no affect.

有什么办法可以解决这个问题?

Is there any way to get around this?

推荐答案

这是我想出的解决方案:

Here is the solution i came up with:

出于直接共享PDF链接的目的,我共享HTML页面的链接,重定向到PDF文件.这样,您可以在标头中使用打开图元标记,以便供Facebook爬虫阅读,然后点击链接即可提供PDF文件.您将必须指定要使用的标签.

Insted of sharing a link to the PDF directly, i share the link of a HTML page, redirecting to the PDF file. This way you can have the Open Graph metatags in the header for facebooks crawler to read, and clicking on the link will serve the PDF file. You will have to specify the tags thatyou want to use.

我是怎么做到的

<meta property="og:url" content="www.example.com/myfile.pdf?attach=0" />
<meta property="og:type" content="article" />
<meta property="og:title" content="This is the title" />
<meta property="og:description" content="here is the desctiption" />
<meta property="og:image" content="http://example.com/img.jpg />
<meta HTTP-EQUIV="REFRESH" content="0; url=www.example.com/myfile.pdf?attach=0">

?attach = 0表示应该在浏览器中查看PDF.

?attach=0 indicates that the PDF should be viewed in the browser.

?attach = 1表示应下载PDF.

?attach=1 indicates that the PDF should be downloaded.

要查看Facebook看到的元数据,请查看打开图形对象调试器

To see the metadata facebook sees, check out Open Graph Object Debugger

这篇关于在Facebook上发布PDF链接时如何获取元数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆