putyourlightson / craft-blitz

Intelligent static page caching for creating lightning-fast sites with Craft CMS.
https://putyourlightson.com/plugins/blitz
Other
149 stars 36 forks source link

Exclude parts in template #270

Closed thomasgoemaere closed 3 years ago

thomasgoemaere commented 3 years ago

Question

I was wondering if it is possible to exclude certain template parts from being cached. For example a cookie consent banner or a popup modal with a newsflash that are hidden after user interaction, so they don't popup on every page load but only on the first request by the user. Those elements doesn't need to be in the cached html (otherwise those elements keep showing up every time the cached page gets loaded).

I'm not finding anything about this in the docs, or am I missing something?

Thanks in advance, Kind regards, Thomas

bencroker commented 3 years ago

Blitz supports full page caching only so you can't exclude partials. For that, you'll probably want to reach for the dynamic content feature (https://putyourlightson.com/plugins/blitz#dynamic-content), or use Sprig (https://putyourlightson.com/plugins/sprig).