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

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

amityweb opened this issue · comments

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.

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.

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.

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.

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