Skip to main content

Twitter Cards missing Image

By November 20, 2017Dev Log

“Facebook allows images to be on a different server. Twitter does not.”

The Rest of the Story

Twitter Cards are a great way to share links on Twitter. In addition to the link, they include a summary and an image.

We also use Facebook Sharing to do essentially the same thing. As chance would have it, we set up Facebook first. Facebook complained that the images sometimes didn’t load fast enough. We placed the shared images on our AWS server so they would load faster. This was fine. For Facebook.

After setting up some Twitter Cards we noticed that the image wasn’t loading properly.

We found a lot of suggestions on how to fix this, but none of them worked.

Finally, one site suggested that it might be because of robots.txt configured to disallow indexing of wordpress images.

User-agent: Twitterbot
Disallow: *
Allow: /wp-content/uploads/*

This was NOT the problem that we had, but it suggested that Twitter might be requiring that the image be located on the same server as the shared page. This in fact is what the problem turned out to be.

Once we hosted the images on our server the Twitter Card images showed up properly.