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

allow excluding routes from prerenderer crawling #308

Closed
danielroe opened this issue Jun 22, 2022 · 10 comments
Closed

allow excluding routes from prerenderer crawling #308

danielroe opened this issue Jun 22, 2022 · 10 comments
Labels
enhancement New feature or request prerender

Comments

@danielroe
Copy link
Member

danielroe commented Jun 22, 2022

Would be nice if something is intended to be dynamic.

Perhaps we could support prerender.exclude with RegExp, function or string signature? Or a render hook with option to skip rendering (#88)?

@kevinmarrec
Copy link
Contributor

@pi0 What are your thoughts regarding implementation ? Let me know if I can help :)

@pi0
Copy link
Member

pi0 commented Jun 29, 2022

Sure makes sense to introduce an option (array) filtering exact URLs for patterns with * and **. (I would avoid less explicit fn and regex and hook allows to have advanced context).


(off topic) BTW I can see this is linked to kevinmarrec/nuxt-pwa-module#7. The module should probably use a server handler to generate manifest which then works with nitro :) We can also improve the crawler to avoid overriding already written (public) assets. I wouldn't use feature from this issue for working around.

@chris-visser
Copy link

One thing I do like about the Next implementation is that you can specify on the page component whether it should be prerendered or not. Did you consider something like this on the template or script tag? eg:

<template static>
</template>

This would prevent complex rules that people would have to learn. Maybe even make it work so it applies the setting to any nested pages (for example on a blog page and that all of its article detail pages automatically would have static generation applied)

@pi0
Copy link
Member

pi0 commented Jul 1, 2022

@chris-visser This is possible to be done using unified route rules to specify group of routes to be static cached (prerenderd)

https://github.com/nuxt/framework/discussions/560

@chris-visser
Copy link

Wauw nice! Have a lot of catching up to do with all of Nuxt 3's features, but honestly great stuff!

@hanneskuettner
Copy link
Contributor

Seems like simple string filtering is supported with commit a6cbbbe and the prerender.ignore option. It just seems to be undocumented right now.

@thezzisu
Copy link

thezzisu commented Mar 7, 2023

I now have a need to exclude all routes except several routes to be prerendered. But plain string prefix won't work for me, neither will routeRules work (which will cause the index page to be prerendered when in SSR mode). I've already made a PR for that.

@Siilwyn
Copy link

Siilwyn commented May 17, 2023

Just started testing pre-rendering and route rules but they do not feel intuitive to me, especially when crawling is on it means I have to duplicate route logic. Thoughts on using routeRules for matching routes to prerender instead of having a separate ignore option?

E.g. to prerender articles: routeRules: { '/articles/**': { static: true } }

@Hebilicious
Copy link
Contributor

I believe this is possible with routeRules and prerender:false :
routeRules: { '/articles/**': { prerender: false } }

@pi0
Copy link
Member

pi0 commented Jul 28, 2023

  • We have predenrer:routes in order to extend via hook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request prerender
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants