strapi-community / strapi-plugin-slugify

A plugin for Strapi Headless CMS that provides the ability to auto slugify a field for any content type.
https://market.strapi.io/plugins/strapi-plugin-slugify
MIT License
45 stars 21 forks source link

Plugin working with multiple locales #104

Closed j-tap closed 1 year ago

j-tap commented 1 year ago

Hello, there are several languages, the plugin adds a slug field for each, they must be unique, but this is not the user's problem. It would be great to implement such an option so that the locale is automatically substituted at the end.

// plugins.js
slugify: {
    enabled: true,
    config: {
      contentTypes: {
        post: {
          field: 'slug',
          references: ['title', 'locale'], // here locale not work 
        },
      },
    },
  },

As a result, when filling in the title: My super post, if the En locale is selected, the plugin will fill in the slug: my-super-post-en. This will preserve uniqueness, add user friendliness, and make it easier to get a Post record with a selection by the slug field.

ComfortablyCoding commented 1 year ago

Have you tried adding locale as a reference? I believe it is a field on the content type (injected) so it should work.

If your request was specifically for the auto suffix then I am not sure I will do that. If it's a supported option that users can already do I would rather leave it up to the user than add it as a toggle option.

ComfortablyCoding commented 1 year ago

Closing due to inactivity, will re-open if any response or further interest.