strapi-community / strapi-plugin-slugify

A plugin for Strapi Headless CMS that provides the ability to auto slugify a field for any content type.

Home Page:https://market.strapi.io/plugins/strapi-plugin-slugify

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plugin working with multiple locales

j-tap opened this issue · comments

commented

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.

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.

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