Next.js Discord

Discord Forum

Need help with dynamic Meta Data in pages directory.

Answered
Godspeed posted this in #help-forum
Open in Discord
Avatar
GodspeedOP
So i have a blog website and i want to add Meta data such that the title of the blog, its description and the image is seen on social media links (the way we see it while sharing on WhatsApp). All this data is coming from an API based on the blog_type and blog_id.

I am using "pages" directory for each page and my "layout" file is in components folder with its functional component wrapping over the website in _app.js.

Nextjs Version : 13.4.1
Answered by Godspeed
One way i found is to make the api call in getServerSideProps and return the object of all data you need for dynamic meta data. This has worked for me.
View full answer

1 Reply

Avatar
GodspeedOP
One way i found is to make the api call in getServerSideProps and return the object of all data you need for dynamic meta data. This has worked for me.
Answer