问题
I have some social sharing buttons on a site. I've been able to use the open graph tags to specify exactly what I want shared. They work with every major social network except Tumblr. Does anyone know why or what I should be doing instead? Thanks!
回答1:
Even though this is an older post, I came across it and figured I'd post a reply for future folks. I hope the OP found a more timely answer.
It depends how your open graph tags set up - on your index page? Or on your permalink pages? Facebook does not allow you to pass it parameters, it can only grab what is on the page. So on the index page it can only grab the general blog info since there's no way on a page with many posts write out unique OG meta tags. Whereas on the individual permalink pages you can create the open graph tags to be specific about the post. Here is a link from the addthis.com support page that explains how facebook grabs its open graph info and why it's not post specific when shared from the main index page: http://support.addthis.com/customer/portal/questions/245592-share-buttons-on-tumblr-posts
Here is a link to the Like button page that explains overall how the open graph tags work: http://developers.facebook.com/docs/reference/plugins/like/
Here is an example of setting up your tumblr template so that it can grab more detailed information on the permalink pages:
<!-- OPEN GRAPH INFO-->
<meta property="og:type" content="blog" />
<meta property="og:site_name" content="{Title}" />
{block:PermalinkPage}
<meta property="og:title" content="{block:PostSummary}{PostSummary}{/block:PostSummary}" />
{block:Posts}
{block:Photo}
<meta property="og:image" content="{PhotoURL-500}" />
{/block:Photo}
{block:Answer}
<meta property="og:image" content="{AskerPortraitURL-128}"/>
{/block:Answer}
{block:Text}
<meta property="og:image" content="{PortraitURL-128}" />
{/block:Text}
{block:Photoset}
{block:Photos}
<meta property="og:image" content="{PhotoURL-500}" />
{/block:Photos}
{/block:Photoset}
{block:Quote}
<meta property="og:image" content="{PortraitURL-128}" />
{/block:Quote}
{block:Link}
<meta property="og:image" content="{PortraitURL-128}" />
{/block:Link}
{block:Chat}
<meta property="og:image" content="{PortraitURL-128}" />
{/block:Chat}
{block:Video}
<meta property="og:image" content="{PortraitURL-128}" />
{/block:Video}
{/block:Posts}
{/block:PermalinkPage}
{block:IndexPage}
<meta property="og:title" content="{block:Description}{MetaDescription}{/block:Description}" />
<meta property="og:image" content="{PortraitURL-128}" />
{/block:IndexPage}
<meta property="fb:app_id" content="YOUR_FB_APP_ID" /> <!-- YOU CAN ALSO USE A DIFFERENT TAG FOR YOUR PROFILE ID INSTEAD NOTE - use one of the other, not both -->
<meta property="fb:admins" content="YOUR_FB_ADMIN_ID" />
<!-- END OPEN GRAPH -->
来源:https://stackoverflow.com/questions/10525543/tumblr-ignores-open-graph-tags