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

Warmup routes with query string #5

Open
jeremyvienney opened this issue Nov 8, 2019 · 3 comments
Open

Warmup routes with query string #5

jeremyvienney opened this issue Nov 8, 2019 · 3 comments

Comments

@jeremyvienney
Copy link

It is a super addon for Statamic but in the case we have a page with a mounted collection with pagniation, it will be great to have the possibility to "warmup" also all this pages.
We could add the same option than for whitelisting querystrings :

'/annonces*':
  page: '[0-9]+'

What do you think ? Is it possible easily ?

@wanze
Copy link
Owner

wanze commented Nov 12, 2019

Hi @thisJerem ,

Interesting question, I see the use case for this. But how does the addon know how many paginated page there is?

https://foo/annonces?page=1
https://foo/annonces?page=2
https://foo/annonces?page=3
...
https://foo/annonces?page=99
https://foo/annonces?page=100

This information would need to be present in the configuration somehow. I am not sure how to encode this, do you have any idea?

Cheers

@wanze
Copy link
Owner

wanze commented Nov 13, 2019

Thinking again about this, the addon could simply offer a list of additional URLs to warmup, e.g.

warmup_additional_urls:
  - https://foo.com/annonces?page=1
  - https://foo.com/annonces?page=2
  - https://foo.com/annonces?page=3
  - https://foo.com/annonces/bar?page=1&sort=desc

This also allows to create the static cache for URLs resolved via template routes.

@thisJerem What do you think about this?

@jeremyvienney
Copy link
Author

Hi wanze !

I think that would be great because that solved the case with template routes, mine for example are like this :

routes:
  /annonces:
    template: recherche
    withFilters: true
    load: /annonces
  '/annonces/{category}':
    template: recherche
    load: /annonces
    withFilters: true
  '/annonces/{category}/{discipline}':
    template: recherche
    load: /annonces
    withFilters: true

For query params your solution is cleary the most simple as I think we don't need to warmup all paginated pages but maybe only a few, at least the most consulting based on tracking data, so manual adding for this kind or url are a good choice !

I don't had time yet to test it but I was thinking about warmup the cache based on the sitemap, what do you think about it ?

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