#Dynamic Metadata Title/Description from JSON

11 messages · Page 1 of 1 (latest)

balmy grove
#

Hi, I've been creating product pages dynamically with nextjs app router, by creating jsons for each product. I am a bit confused about the dynamic metadata I have setup the template titles for other pages on the website, but I want to use the product tile and description from the json for the page metadata title and description

Attached a screenshot to explain

Pretty new to react so any help on how I can add the product.json title & description would be appreciated thanks

dusky heronBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

modest crow
#

Try installing next-seo and instantiate a component for it then import your json into that component file then plug some logic via the routing API and that should work

modest crow
#

Added bonus, next seo makes managing your seo much easier

rocky siren
#

i would have thought use dynamicMetadata because its a native nextjs thing... (plus using react cache to not do the same query twice)

rocky siren
balmy grove
#

@modest crow thanks for this, I will look into next-seo

#

and thank you @rocky siren for the documentation I've just been able to sort my pages! life saver

#

and thank you for sharing that forum post also, I will take a look