rob-murray / jekyll-twitter-plugin

A Liquid tag plugin for the Jekyll blogging engine that embeds Tweets, Timelines and more from Twitter API
MIT License
238 stars 30 forks source link

Cache never gets used #25

Closed nickjj closed 7 years ago

nickjj commented 7 years ago

Hi,

I'm using the {% twitter ... %} tag and it correctly writes out a hashed file for a Tweet in the .tweet-cache folder but I don't think this file ever gets read.

If I edit the cached file to modify a tweet it still pulls the original. This holds true even if I completely shut down and rebuild the site with Jekyll. I even went as far as modifying the render method to only return the cached_response but it seems to still pull the live_response.

rob-murray commented 7 years ago

The cached file is used by Jekyll to render the page as html, this content usually includes a script tag for some JS from Twitter. When the page is rendered in the browser this JS is executed and your browser fetches images and Tweet content from Twitter - whatever is displayed in the content from Jekyll will be overwritten by Twitter. If you want to opt out of this then use the param omit_script=1.

The cached response is to speed up build by not having to fetch content from Twitter every build, how it is displayed in the browser is controlled differently.