mattmilburn / strapi-plugin-preview-button

A plugin for Strapi CMS that adds a preview button and live view button to the content manager edit view.
MIT License
104 stars 38 forks source link

Customize the url based on locale #87

Open jphilung opened 1 year ago

jphilung commented 1 year ago

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 ?

Shekhar-Zealous commented 1 year ago

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

mattmilburn commented 1 year ago

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.

Shekhar-Zealous commented 1 year ago

@mattmilburn The extended solution hook isn't working from my side which I have already mentioned here https://github.com/mattmilburn/strapi-plugin-preview-button/issues/69#issuecomment-1517594724. Can you please help here. Thanks

ectuser commented 1 year ago

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

mattmilburn commented 1 year ago

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.

Shekhar-Zealous commented 1 year ago

@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