Sharing is caring

Let's embed images in our posts

LET’S MAKE SHARING BETTER ON THIS PAGE. I saw this today:

That links to this excellent post on socializing your blogdown.

Turns out my (slightly) modified GhostWriter theme is mostly setup for this already. I just needed to add a description and twitterImg to the post metadata and it works.

Under the theme/layout/partials/header.html file I added the following right at the end of the <head> portion:

    {{ if .Params.twitterImg }}
       <meta name="twitter:card" content="summary_large_image">
       <meta name="twitter:image" content="http://lenkiefer.com/{{ .Params.twitterImg }}" >
     {{ else }}
       <meta name="twitter:card" content="summary">
       <meta name="twitter:image" content="http://lenkiefer.com/img/logo/logo.png" >
    {{ end }}
    <meta property="og:title" content="{{ .Title }}">
    <meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage }}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">

Check it out, click share below.

 Share!