I've got a matrix block that most pages on my site are built from, and one of its blocks is a Solspace Freeform form field. I want to be able to cache the entire output of the matrix, but that makes Freeform see all form submissions as spam, since their hash gets cached too.
So I tried https://github.com/benjamminf/craft-nocache but couldn't get that to work as the whole matrix (including the form) gets cached outside of the {% nocache %}
tag. So then I tried:
{% set bodyIncludesForm = entry.body.type('form') | length > 0 %}
{% cache globally using key craft.request.path unless bodyIncludesForm %}
...
... which seems to work, but that entry.body.type('form')
call adds 32 queries which kind of defies the point of the caching!
Any idea how to get round this, without turning off Freeform's spam check?
entry.body.type('form')
outside of the cache loop, and that seems really expensive, adding 32 queries.