Next.js Discord

Discord Forum

Best way to implement an embed feature from NextJS app

Answered
PixeledCode posted this in #help-forum
Open in Discord
Assuming you have a dashboard like this https://d4d.civicdatalab.in/morigaon/panchayat-and-rural-development/mgnrega?tab=explorer&indicator=nhaoe built using NextJS and there are chart on the page that can be embedded on some other site. What is the best way to approach to implement a functionality like this?

Options I have thought:
1. Create a new page maybe app/embed/chart/page.tsx and only load the chart component in that page. Share that link for embedding.
2. Use Puppeteer or some other headless browser to implement this, if it's even possible that way

Looking for any thoughts in this topic
Answered by DirtyCajunRice | AppDir
1. is the right way to do it
View full answer

4 Replies

1. is the right way to do it
Answer
2. isnt really a thing
3. would be making a library they can import that creates a customizable portal that calls your apis natively
oh I like third technically but it will be a challenge for lets say a journalist to do it. Ideally they should be able to get embed code and copy paste. Thanks!