Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: cache busting #382

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

evgeny-kim
Copy link

Hi. Thank you for your great template!

I'm currently setting up caching. It might be a good idea to implement cache busting.
We could add a hash to all JS and CSS assets and allow them to be cached forever, and disable caching for HTML.

Here's my approach in more detail:

  1. Move scripts and CSS files from /static to /assets, fingerprint them
  2. Put Photoswipe under versioned path /static/lib/photoswipe/4.1.2/, now it can be safely cached
  3. main.js is already fingerprinted. We can transpile and minify it
  4. Update figure shortcode to allow page resources caching.

I got the latest built-in figure shortcode that makes use of page resources. A fingerprint is added to page resources. Other links are not changed. The original hugo-easy-gallery logic around "src", "link" and "thumb" parameters is preserved.

I also updated the full config with an example of Cache-Control settings.

Would be glad to hear your thoughts.

@evgeny-kim evgeny-kim changed the title Feature/cache busting Feature: cache busting Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant