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

ignore_query_strings with specified query parameters #1306

Closed
indykoning opened this issue Feb 3, 2025 · 3 comments
Closed

ignore_query_strings with specified query parameters #1306

indykoning opened this issue Feb 3, 2025 · 3 comments

Comments

@indykoning
Copy link

As mentioned in
statamic/cms#3111 (comment)
a useful feature would be to let static_caching.ignore_query_strings accept an array of query strings as well.

This could be used to filter the url parameters in https://github.com/statamic/cms/blob/6969fb6c54ce7f6630ae36d0d814aa6f4341c8d8/src/StaticCaching/ServiceProvider.php#L42

Why would this be useful?

Marketing tools love to throw useless url parameters into the mix, like:

  • utm_source
  • utm_medium
  • source
  • ad_network

forcing Statamic to build these pages uncached, and creating cache files for a request that will only ever be used once.

This solution would leave the current nginx rules unable to resolve the file, but it would still be much faster and space efficient since it would be able to resolve the cache in PHP

@duncanmcclean
Copy link
Member

I'm not sure if they've been documented yet, but have you seen statamic/cms#10701? It allows you to specify query parameters which'll be ignored when Statamic decides if a page already exists in the static cache.

@indykoning
Copy link
Author

indykoning commented Feb 4, 2025

I hadn't found it on the docs when I made this, I'll take a deeper look at it later and let you know.

Looking at the code this is exactly what I had in mind for this though!

Edit: there is indeed no documentation of this as of yet

@indykoning
Copy link
Author

The feature is already implemented, even if not documented yet. So i can close this idea 🚀

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

No branches or pull requests

2 participants