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

Can't get it working, slug Text field does not get set based on product name Text field #92

Closed amityweb closed 1 year ago

amityweb commented 1 year ago

Can't get it working:

module.exports = ({ env }) => ({
    //
    slugify: {
        enabled: true,
        config: {
            contentTypes: {
                product: {
                    field: 'slug',
                    references: 'name',
                },
            },
            skipUndefinedReferences: true,
            shouldUpdateSlug: true,
        },
    },

Its installed, it says so in the Plugins list, and picking it up I can see this in console:

The server is restarting
[2023-04-26 15:41:08.255] info: [slugify] graphql detected, registering queries

Am using Strapi 4.7.0.

ComfortablyCoding commented 1 year ago

I cannot replicate this issue with a clean install of the latest strapi version.

I created the following content type

{
  "kind": "collectionType",
  "collectionName": "products",
  "info": {
    "singularName": "product",
    "pluralName": "products",
    "displayName": "product"
  },
  "options": {
    "draftAndPublish": true
  },
  "pluginOptions": {},
  "attributes": {
    "slug": {
      "type": "string"
    },
    "name": {
      "type": "string"
    }
  }
}

and added the settings provided. When creating or saving the record(s) the slug field gets updated with the slugified version of the name field.

amityweb commented 1 year ago

I figured out it's not working on existing entries. I created a new Products, and it worked. But editing existing ones created before adding the plugin does not work. I changed them to Draft and re-Published also.

ComfortablyCoding commented 1 year ago

That should not be the case, and I do not believe it was when I checked originally. I will check again and see if I can reproduce this issue.

ComfortablyCoding commented 1 year ago

Closing as I cannot reprpduce this, will re-open if any reproducible steps are provided.