faktaoklimatu / web-core

The core website framework for climate facts websites
https://faktaoklimatu.cz
Other
0 stars 1 forks source link

Load all infographics and explainer images by version #107

Open mukrop opened 3 years ago

mukrop commented 3 years ago

Load all infographics and images in explainers by version (file?v=xxx). Use either the file's last commit hash or modification timestamp. This will allow us to do reliable updates at precise time points while retaining reasonable cache values. For reasoning, see below.


Original description:

Currently, production cache is dropped to 10 minutes (0ddb93d) due to publishing AR6 infographic updates. Discuss if such situations are going to be more frequent. If so, consider adjusting image loading. Revert the workaround.

mukrop commented 3 years ago

What about adding version to loading URLs for all infographics and explainer images? (?v=xxx) Current commit hash can be used easily (but file's hash may also be realistic). @mgrabovsky, do you see any problems in adding this?

mgrabovsky commented 3 years ago

I actually had the same idea when I first read this issue. I suppose we could use either the file's last commit hash or the file's modification time.

mukrop commented 3 years ago

I've reverted the short cache (it increased our hosting payments) and adjusted the issue to be about loading assets using version as suggested.

mukrop commented 2 years ago

After googlig for solutions: Getting a git commit hash for static files is complicated (much easier for Jekyll objects, though). Nevertheless, Jekyll stores last-modified-at time for static files as well, see details at https://jekyllrb.com/docs/static-files/ which seems to be the easiest option to implement this.