Search code examples
htmlmetadatafacebook-opengraphtumblr

og:image taken from tumblr page content


I am developing a tumblr site for programming jokes.

On this site I am using the following Facebook OpenGraph metadata to generate the thumbnail for a post when it is Liked:

<meta property="og:image" content="{PortraitURL-128}"/>

This specifies the tumblr page icon at size 128x128. What I would like is to parse the page and generate the icon dynamically by picking the image in each post. Does anyone know if this is possible?


Solution

  • You can do it for sure if you're on the Permalink page by doing this:

    {block:PermalinkPage}{block:Posts}
        {block:Photo}
        <meta property="og:image" content="{PhotoURL-500}">
        {/block:Photo}
    {/block:Posts}{/block:PermalinkPage}