Next.js Discord

Discord Forum

Is there way to revalidate the literal route segment (e.g. /product/123) ?

Unanswered
nrsimha posted this in #help-forum
Open in Discord
Avatar
nrsimhaOP
Is there way to revalidate the literal route segment (e.g. /product/123) instead of /product/[id]?

It is possible to call revalidatePath function (https://nextjs.org/docs/app/api-reference/functions/revalidatePath) in API route, but in description for the path argument it is written:
path: A string representing the filesystem path associated with the data you want to revalidate. This is not the literal route segment (e.g. /product/123) but instead the path on the filesystem (e.g. /product/[id]).


If the website has million of pages which change very rarely and one page/product has been edited, it will be practical to be able to revalidate only page which has been changed though specific path like /product/123456 instead of revalidating all pages.

Is there any way to achieve that using app folder?

0 Replies