问题
the past few days I've been working to get a facebook comment box installed on my blog that I've set up with open graph tags so that my blog can be liked as a facebook page. From what I can see on the page, all seems to be functioning normally, but when I run my blog address through the debugger, I get the following errors.
Here is the link to my site: www.mommysnark.com
And here are the errors that the debugging tool gives me:
A like button warning that should be fixed: og:title is missing. The og:title meta tag is necessary for Facebook to render a News Feed story that generates a high clickthrough rate.
And finally, the open graph warnings that should be fixed:
Inferred Property:The 'og:url' property should be explicitly provided, even if a value can be inferred from other tags.
Inferred Property:The 'og:title' property should be explicitly provided, even if a value can be inferred from other tags.
Inferred Property:The 'og:description' property should be explicitly provided, even if a value can be inferred from other tags.
It appears that everything is working, so can these errors just be ignored?
回答1:
You'll want to correct all errors for best results. The properties og:title
and og:url
are especially important to your purposes. Here is the Open Graph stuff from my blog at formlesspoet.blogspot.com. You can use it for reference:
<!-- BEGIN FACEBOOK OPEN GRAPH -->
<b:if cond='data:blog.pageType == "archive"'>
<meta expr:content='"Posts from " + data:blog.pageName + " at Form and Formlessness"' property='og:title'/>
</b:if>
<b:if cond='data:blog.pageType == "index"'>
<b:if cond='data:blog.searchQuery'>
<meta expr:content='"Search results for “" + data:blog.searchQuery + "”" + " at Form and Formlessness"' property='og:title'/>
</b:if>
<b:if cond='data:blog.searchLabel'>
<meta expr:content='"Posts tagged under “" + data:blog.searchLabel + "”" + " at Form and Formlessness"' property='og:title'/>
</b:if>
<b:if cond='data:blog.searchQuery == ""'>
<b:if cond='data:blog.searchLabel == ""'>
<meta expr:content='"Form and Formlessness"' property='og:title'/>
</b:if>
</b:if>
</b:if>
<b:if cond='data:blog.pageType == "item"'>
<meta expr:content='"“" + data:blog.pageName + "”" + " at Form and Formlessness"' property='og:title'/>
</b:if>
<b:if cond='data:blog.pageType == "static_page"'>
<!--Static Page-->
</b:if>
<meta content='article' property='og:type'/>
<meta content='This blog follows an exploration of poetry by Zahhar, going as far back as 1995. Posts include his poetry and articles about poetry, prosody, and poetics.' property='og:description'/>
<meta expr:content='data:blog.url' property='og:url'/>
<meta content='http://sphotos.xx.fbcdn.net/hphotos-ash3/538645_3357819035748_1577184006_2624573_712999292_n.jpg' property='og:image'/>
<meta content='1577184006' property='fb:admins'/>
<meta expr:content='data:blog.title' property='og:site_name'/>
<!-- END FACEBOOK OPEN GRAPH -->
Note that the og:title
property is set differently depending on what sort of page you're looking at. I'm trying to find a way to refine this further, but I'm still waiting on an answer. The og:description
and og:url
properties can be found near the bottom. Note that I'm using some Blogger specific stuff to get the title and URL of the current page for the og:title
and og:url
properties. You'll want to do the same. Presently the og:description
property is static, but I plan to eventually find a way to make it more versatile. Still working on learning how. The URL used for the og:image
property is actually linked to a photo in one of my Facebook albums.
来源:https://stackoverflow.com/questions/9712897/open-graph-debugger-tool-errors-inferred-property