LET’S MAKE SHARING BETTER ON THIS PAGE. I saw this today:
💫 how-to for making your #blogdown social-friendly: "Socialize your blogdown" by @xvrdm https://t.co/RurfUvRf6X #rstats #opengraph pic.twitter.com/HY0Id0V7Yk
— Mara Averick (@dataandme) October 23, 2017
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.