wbobeirne / datocms-plugin-nextjs-preview

DatoCMS plugin for linking your entities to live and preview versions on your Next.js site
10 stars 14 forks source link

Invalid slug with multi language #8

Open vishalshah6153 opened 2 years ago

vishalshah6153 commented 2 years ago

Hi, I configured the plugin as per instructions and it's working perfectly with a single language feature. But, when we have a multi-language feature it's not working properly as I haven't seen a language selection dropdown. I have used the https://github.com/vsimak/datocms-plugin-nextjs-preview-multilang-sidebar fork and installed it.

When I click on the preview link, the link will be open in the browser as below https://example.com/api/preview?slug=/null/home&secret=784854 where null should be selected locale. And it's ended up with a 404 not found error.

Any idea for this? Thanks in advanced.

wbobeirne commented 2 years ago

Hey @vishalshah6153, we'll have to hear from @vsimak about why that might be, I haven't looked at his fork. There's also a PR open (#5) that attempts to add locales as well.

Unfortunately I no longer work at the company that was using DatoCMS, and so I don't have an environment to work on this plugin. I may archive this repo or try to find someone else to maintain it.

marcello-palmitessa commented 2 years ago

Hi, I have the same issue for a Next multi-language website, and the client is very angry about this issue....

cymkd commented 2 years ago

Hi @vishalshah6153, and hi @wbobeirne. I had a project and needed to have a working multi-language DatoCMS preview plugin. I've forked and fixed the locale appending in the URL that did not work properly on the other plugin's I tried.

I am unsure what is going wrong on your end, we are using the same plugin for a live website, and all is working fine.

What you are describing - the null issue for locale - is why I forked and edited the code a bit to get it working in the first place.

Bare in mind, there is no dropdown language selector, the Preview Link plugin checks the active language tab in DatoCMS and appends that language to the url.

robrechtme commented 2 years ago

Hi

Are you accepting PR's? If so I have a working version of the plugin with locales.

wbobeirne commented 2 years ago

Hey @robrechtme, you're probably better off forking and using your own version. I've stopped using DatoCMS so won't easily be able to test any submitted PRs. I'll probably switch the project into archive mode, thanks for the reminder.