Next.js Discord

Discord Forum

Dynamic meta deta is not updating as expected due to production static site generation

Answered
Cape lion posted this in #help-forum
Open in Discord
Avatar
Cape lionOP
Guys i am fetching meta setting (set from admin panel) from mongodb then i pass it to generateMetadata function

this add dynamic meta data in localhlost as page is always server side rendered but in production nextjs treat my home page or about page as Static site generation due to which my dynamic tags becomes undefined how can i opt out of static site generation


make sure you understand that i am doing this for

https://example.com/

i know about dynamic routes or params but that not the usecase here

i want to update meta setting from admin panel for static pages
Answered by B33fb0n3
you can either invalidate your page on demand using revalidatePath or revalidateTag or if you just want to make the whole thing dynamic you can add
export const dynamic = 'force-dynamic';

I guess the first part of this message more suites your needs
View full answer

3 Replies

Avatar
you can either invalidate your page on demand using revalidatePath or revalidateTag or if you just want to make the whole thing dynamic you can add
export const dynamic = 'force-dynamic';

I guess the first part of this message more suites your needs
Answer
Avatar
Cape lionOP
alright for now i used force-dynamic but i'll read the doc for revalidate path and tag later
Avatar
sounds good