mattmilburn/strapi-plugin-preview-button

Customize the url based on locale

jphilung opened this issue · 6 comments

I need to localize my urls as some parts of my path are localized, e.g.

{
  published: {
    url: 'http://localhost:3000/{locale}/movie/{slug}',
    url: 'http://localhost:3000/{locale}/film/{slug}',
  },
}

How could I easily handle this case ?

I am looking for a same solution here.
@mattmilburn Is there any solution to achieve this?

Hi @jphilung @Shekhar-Zealous Have you tried extending the plugin as described in the Extending section of the docs? This let's you modify the URL at run time while having access to the current entity data, which would include the locale.

@mattmilburn The extended solution hook isn't working from my side which I have already mentioned here #69 (comment).
Can you please help here.
Thanks

Hi @mattmilburn . Thank you for developing this project.

I've also done all the steps mentioned in the docs to extend logic via the hook. Unfortunately, it also did not work for me. It seems like this hook has no effect on the url.

If you have, can you please provide some working example project where this hook works?

Thank you

Hi @jphilung @Shekhar-Zealous @ectuser This plugin has now been upgraded to version 2.0.0 with breaking changes to the configuration and a lot of improvements behind the scenes.

I believe this upgrade should resolve the issues you are having with the plugin's custom hook. Please let me know how it goes for you and see the migration guide before upgrading.

Please note this upgrade does not yet include support for populating relations into the URL (eg. using {category.slug} but that feature will be implemented in another update in the future.

@mattmilburn Thanks for the reply.
I'll be waiting for the future update which can include relations.

But as of now, I was in a bit hurry for the project development and my requirement was a bit dynamic so I have to create a plugin of my own just to fulfill the project requirement.

Thank you