@webbio/strapi-plugin-slug

4.0.5 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @webbio/strapi-plugin-slug

Weekly Downloads

67

Version

4.0.5

License

MIT

Unpacked Size

191 kB

Total Files

77

Last publish

Collaborators

  • joerismits
  • martijn-webbio
  • hayedewit
  • maikelm
  • mikewebbio
  • smdehaas
  • tomwebbio
  • fred-webbio
  • jaapwebbio
  • rowanpaul