Tumblr ignores open graph tags

假如想象 提交于 2019-12-04 19:38:20

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 -->
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!