@webbio/strapi-plugin-slug
v3.3.2
Published
A plugin that slugifies a field and updates path fields
Downloads
152
Maintainers
Keywords
Readme
Strapi plugin slug
Features
- A custom slug field that generates a unique slug based on the entity's title.
- Generates a path based on the entity's slug and its parent paths.
- Checks if a slug is unique based on the entity's parent paths and its domain.
Installation
To install this plugin, you need to add an NPM dependency to your Strapi application.
# Using Yarn
yarn add @webbio/strapi-plugin-slug
# Or using NPM
npm install @webbio/strapi-plugin-slug
Configuration
The custom field must be added together with two other fields (path
and parent
). In the slug pluginOptions make sure the field and targetField are set correctly.
...schema.json
// ...
"slug": {
"pluginOptions": {
"i18n": {
"localized": true
},
"slug": {
"field": "slug",
"targetField": "title"
}
},
"type": "customField",
"customField": "plugin::slug.slug",
"required": false
},
"path": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string",
"required": false
},
"parent": {
"type": "relation",
"relation": "oneToOne",
"target": "api::page.page"
}
// ...
./config/plugins.ts
module.exports = ({ env }) => ({
// ...
slug: {
enabled: true
}
// ...
});
Then, you'll need to build your admin panel:
# Using Yarn
yarn build
# Or using NPM
npm run build