B. Shaffer
B. Shaffer

Reputation: 29

How to add Twitter card image to post created in blogdown

I created a post in blogdown from a .Rmd file. The header of the file includes:

---
title: Social assistance and unemployment duration in Alberta
author: Blake Shaffer
date: '2018-11-30'
slug: caseload-duration
categories: []
tags: []
twitterImg: post/2018-11-29-caseload-duration-files/figure-html/unnamed-chunk-5-1.png
header:
  caption: ''
  image: '/caseload-duration-banner.png'
---

But when I tweet a link to the post, the image does not appear:

TwitterCard created by link without image

I am using blogdown via RStudio, and the hugo/gcashen-academic theme.

Is there something I am missing?

Upvotes: 2

Views: 672

Answers (1)

Terence Eden
Terence Eden

Reputation: 14314

I ran your post though the Twitter Card Validator - https://cards-dev.twitter.com/validator

It seems to work - the image is displayed. Looking through the source for https://www.blakeshaffer.ca/post/caseload-duration/ I notice one possible problem on this line:

<meta name="twitter:image" content="http://blakeshaffer.ca/post/2018-11-29-caseload-duration_files/figure-html/unnamed-chunk-5-1.png" >

You should make sure that the image is referenced using https rather than just http

Upvotes: 1

Related Questions