USGS-VIZLAB / vizlab

Package with utilities for building vizlab pages
Creative Commons Zero v1.0 Universal
25 stars 14 forks source link

change twitter thumb url when image changes #383

Open wdwatkins opened 6 years ago

wdwatkins commented 6 years ago

https://developer.twitter.com/en/docs/tweets/optimize-with-cards/guides/troubleshooting-cards.html

Seerefreshing a card in a Tweet on how to make the twitter crawler refresh thumbnails.

To work-around this issue, you can add an extra parameter at the end of your image URL so that the Twitterbot treats the image as a unique URL and re-fetches the image.

For example:
<meta name="twitter:image" content="http://example.com/myimage.jpg?4362984378"></meta>

This could be automated in vizlab by adding a variable to the template that is filled with a random number to create a "new" thumb url. Could maybe do this based on a hash or timestamp of the image file, or just regenerate it each time.

Probably worth looking into if this applies for other platforms e.g. facebook that probably have a similar crawler setup.