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}}{% link /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.

Get updates on Twitter

I wrote this because I felt like it. This post is not associated with my employer. This site is hosted by Netlify (who are great, but I'm not associated with them either).