Tumblr上的Facebook开放图谱协议

时间:2012-07-15 16:41:33

标签: facebook opengraph tumblr open-graph-protocol

当我在Tumblr博客上发布链接时,Facebook会在标题标签之间抓取标题,而不是在Open Graph元标记中指定的标题。它为什么这样做?有没有办法解决它?

1 个答案:

答案 0 :(得分:16)

在没有看到代码的情况下,我不确定你的问题究竟是什么,但是对于其他任何寻找如何在他们的博客上设置Open Graph的人来说,尝试做这样的事情:

<!-- FACEBOOK OPEN GRAPH -->
<!-- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-->

<meta property="og:site_name" content="{Title}"/>

{block:PermalinkPage}

    <meta property="og:url" content="{Permalink}"/>
    <meta property="og:type" content="article"/>

        {block:Posts}
            {block:Text}
                {block:Title}<meta property="og:title" content="{PlaintextTitle}"/>{/block:Title}
                <meta property="og:description" content="{PlaintextBody}"/>
            {/block:Text}

            {block:Photo}
                <meta property="og:image" content="{PhotoURL-500}"/>
                {block:Caption}<meta property="og:description" content="{PlaintextCaption}"/>{/block:Caption}
            {/block:Photo}

            {block:Photoset}
                {block:Photos}
                <meta property="og:image" content="{PhotoURL-500}"/>
                {/block:Photos}
                {block:Caption}<meta property="og:description" content="{PlaintextCaption}"/>{/block:Caption}
            {/block:Photoset}

            {block:Quote}
                <meta property="og:title" content="{PlaintextQuote}"/>
                <meta property="og:description" content="{PlaintextSource}"/>
                <meta property="og:image" content="{PortraitURL-64}"/>
            {/block:Quote}

            {block:Link}
                <meta property="og:title" content="{PlaintextName}"/>
                <meta property="og:description" content="{PlaintextDescription}"/>
                <meta property="og:image" content="{PortraitURL-64}"/>
            {/block:Link}

            {block:Chat}
                <meta property="og:title" content="{PlaintextTitle}"/>
                <meta property="og:description" content="{block:Lines}{block:Label}{Label}: {/block:Label}{Line} &bull; {/block:Lines}"/>
                <meta property="og:image" content="{PortraitURL-64}"/>
            {/block:Chat}

            {block:Audio}
                <meta property="og:title" content="{block:Artist}{Artist} - {/block:Artist}{block:TrackName}{TrackName}{/block:TrackName}"/>
                <meta property="og:description" content="{PlaintextCaption}"/>
                {block:AlbumArt}<meta property="og:image" content="{AlbumArtURL}"/>{/block:AlbumArt}
            {/block:Audio}

            {block:Video}
                {block:Caption}<meta property="og:description" content="{PlaintextCaption}"/>{/block:Caption}
            {/block:Video}

            {block:Answer}
                <meta property="og:title" content="{PlaintextQuestion}"/>
                <meta property="og:description" content="{PlaintextAnswer}"/>
                <meta property="og:image" content="{PortraitURL-64}"/>
            {/block:Answer}

        {/block:Posts}

{/block:PermalinkPage}

{block:IndexPage}
        <meta property="og:title" content="{Title}"/>
        <meta property="og:type" content="blog"/>
        <meta property="og:description" content="{MetaDescription}"/>
        <meta property="og:image" content="{PortraitURL-64}"/>
{/block:IndexPage}

应该涵盖你能通过的任何事情!

请记住,所有代码都属于结束</head>标记之前。