Cockpit
Cockpit copied to clipboard
Was the 'slug' option removed from newer versions?
It seems setting slug: true in the latest version of cockpit has no effect. Was it removed as an option? What is the current suggested method for automatically creating slugs for content?
Just found about it too, I think it's gone, missing the feature for a customer.
related: https://github.com/Cockpit-HQ/Cockpit/issues/26
Hi 👋 this had multiple reasons, as it most of the times needed additional custom implementation.
How to implement a (simple) slug solution:
In your /config/bootstrap.php file (create one if not already existing) add the following code:
<?php
// add slug data to an article collection item
$app->on('content.item.save.before.articles', function(&$data) {
// add sluggified version of the title field:
if (isset($data['title']) && $data['title']) {
$data['title_slug'] = $this->helper('utils')->sluggify(trim($data['title']));
}
});