Twitter Card image for large_summary_image type not being pulled

Hi there,

I’m attempting to set up Twitter Cards for my Jekyll site. I am using the following in my head.html:

<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@consortianet">
<meta name="twitter:title" content="{{ page.title }}">
<meta name="twitter:description" content="{{ page.excerpt | escape }}">
<meta name="twitter:url" content="{{ page.url }}">
{% if page.image %}
  <meta name="twitter:image:src" content="{{ site.url }}/assets/images/{{ page.image }}">
{% else % }
  <meta name="twitter:image:src" content="{{ site.url }}/assets/images/{{ post.image }}">
{% endif % }

However, when using Twitter’s Card Validator for a blog post, I receive the following:

Though the card is rendering, it is showing the “summary” type rather than the “summary_large_image” type, and not pulling the post image.

If there is any other relevant information I can share that would help troubleshoot this issue, please let me know. Thanks!

1 Like

what does the rendered meta data look like? is there supposed to be a difference between the if and the else?

Ah - I think where you have post.image you need to have page.image. There is no post object, though you frequently see people use post as the thing in a for loop, I prefer item so it is more obvious.

I tested your site: view-source:
Look your source code.
You had meta tags into BODY tag:

Please fix that :neutral_face:

ah - I see now that your if / else is testing both page.image and post.image.

some of your urls have localhost in them - though not this particular one. Not sure what is wrong, though like @SidV says, you have some other issues that need some work, maybe they are related.

Yikes. Fixed.

Thanks for pointing that out!

Ah, I was still in development mode, that’s why :expressionless:

Now everything looks and works as it should: