jekyll-theme-chirpy: Twitter Cards Missing Images
Checklist
- I have read and accepted the contributing guidelines.
How did you create the site?
Generated from chirpy-starter
Describe the bug
When cards render on twitter, the images are missing example tweet
This has worked in the past past working example tweet
Steps To Reproduce
- Using chirpy theme
jekyll-theme-chirpy (6.4.2) - visit twitter.com
- paste link inside of tweet composer
- see the tweet without an image
Expected Behavior
Twitter cards should render images as they did previously.
Environment
- Ruby:
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin23] - Jekyll:
jekyll 4.3.3 - Chirpy:
6.4.2
* jekyll-theme-chirpy (6.4.2)
Summary: A minimal, responsive, and feature-rich Jekyll theme for technical writing.
Homepage: https://github.com/cotes2020/jekyll-theme-chirpy
Documentation: https://github.com/cotes2020/jekyll-theme-chirpy/#readme
Source Code: https://github.com/cotes2020/jekyll-theme-chirpy
Wiki: https://github.com/cotes2020/jekyll-theme-chirpy/wiki
Bug Tracker: https://github.com/cotes2020/jekyll-theme-chirpy/issues
Path: /Users/user/.rvm/gems/ruby-3.2.2/gems/jekyll-theme-chirpy-6.4.2
Anything else?
@bigsk1 suggested this fix in the tweet above, however I didn’t want to replace the theme’s version of head.html at this time
https://github.com/bigsk1/bigsk1.github.io/blob/main/_includes/head.html
About this issue
- Original URL
- State: closed
- Created 5 months ago
- Comments: 17 (8 by maintainers)
@timothystewart6 I just submitted one
@timothystewart6 looks good bring it on home
All fixed! Seems like it is now fixed for both twitter and og cards. I have an image preview in twitter and the images on other socials only render once: https://github.com/techno-tim/techno-tim.github.io/blob/master/_includes/head.html
I am happy to open a PR, but @bigsk1 did most of the work and I am not sure if my hacks to his liquid code are right 🤣
The issue seems to be needing absolute url for twitter cards
not
My example in head.html
Twitter Image Meta Tag: In both the {% if page.image %} and {% elsif site.social_preview_image %} sections, I added <meta name="twitter:image" content="{{ img_url }}" />. This ensures Twitter has the correct image URL for both specific pages and the site-wide fallback.
Absolute URL for Page Image: For page.image, I’ve ensured the absolute URL is used by applying {{ src | absolute_url }}.