Adding Open Graph meta tags to

My blog posts are auto-posted to Facebook, but they look very plain when posted there. Facebook uses Open Graph tags to determine how to display URLs, and my blog was missing these. My hope is that, starting with this post, my auto-posts will look a little more enticing.

I added these Open Graph tags to every page (generated by Jekyll):

<meta property="og:title" content="{{page.title}}"/>
<meta property="og:type" content="website"/>
<meta property="og:image" content="{{site.url}}/assets/jim_128.png"/>
<meta property="og:url" content="{{ page.url }}"/>
<meta property="og:description" content="{{ page.excerpt | strip_html }}"/>
<meta property="og:site_name" content=""/>

Apparently og:image tags only work with absolute URLs, not relative ones. This is a bit annoying in combination with Jekyll link, which generates relative URLs. Here’s hoping that Facebook finds the photo of me for this post’s image.

Tagged #blog.

Similar posts

More by Jim

👋 I'm Jim, a full-stack product engineer. Want to build an amazing product and a profitable business? Read more about me or Get in touch!

This page copyright James Fisher 2017. Content is not associated with my employer. Found an error? Edit this page.