Tweets not showing images?

AI-generated summary

In a bug report titled ‘Tweets not showing images?’, bartv noticed that tweets linking to their Discourse post weren’t displaying the first image — only a placeholder — unlike other Discourse instances. codinghorror initially suggested configuring Twitter API keys, but bartv noted this wasn’t required on another forum. techAPJ used the Twitter Card Validator and found a warning: the image URL was potentially blocked by robots.txt. Further investigation revealed that the issue affected all fresh Discourse installs and was caused by a recent regression in commit 0fd622e techAPJ. After confirmation, codinghorror approved reverting the commit, which techAPJ did. bartv asked if they could test immediately, and techAPJ explained the fix would be available after the commit landed in the tests-passed branch. By post 11, the fix was confirmed working — tweets now correctly display the first image from Discourse posts. The team thanked bartv for reporting the issue.

Hi,

I’m trying to understand why tweets won’t show the first image from my post. I suspect I’ve got a setting wrong somewhere, but I can’t figure it out.

To demonstrate, here is an original discourse post:

https://forum-test.blendernation.com/t/little-big-planet-sackboy/14

And here’s a tweet with a link to this post. It shows a placeholder image - not even my site logo.

Here’s a test I did with a link to another Discourse instance - as you can see it correctly features the first image.

Is there some settings magic I need to apply to get this to work?

On a related note, is there a way to change the card format to ‘Summary Card with Large Image’? Since we’re running a graphics-oriented community this would make sense for us.

4 Likes

You must configure the twitter API keys in your site settings for this to work as I recall.

Hmm, we haven’t done that on the Sketchfab forum, which shows the images correctly. My hunch is that I’ve misconfigured something else. Also, I think the only available Twitter settings are for authentication?

The Twitter Card Validator is showing this warning for the linked post:

WARN:  The image URL https://forum-test.blendernation.com/uploads/default/optimized/1X/236bbbe9fa50f882fc710f078b22276a6cb3b974_1_690x483.jpg specified by the 'twitter:image' metatag may be restricted by the site's robots.txt file, which will prevent Twitter from fetching it.

Testing this meta topic however looks good on the validator.

4 Likes

Okay, I can verify that fresh Discourse installs are not loading image previews on Twitter.

This was regressed 24 days ago in:

https://github.com/discourse/discourse/commit/0fd622e5d10cdbe9169cfce291729a5596b363eb

Should we revert this commit @codinghorror?

6 Likes

Sure that seems fine. You might ping that user I think he posted here about it.

4 Likes

Okay, that commit is now reverted. I couldn’t find Dan’s account here on meta, but I left the comment on PR.

Thanks for bringing this issue to our notice @bartv. :+1:

5 Likes

Wow that’s very fast indeed! So can I now rebuild + test, or is there something else you guys need to do before this fix is available?

1 Like

You will have to wait for commit to land in tests-passed branch.

4 Likes

The commit is now landed in tests-passed branch and I verified that the issue is fixed now.

3 Likes