monad-slug
Support for slug fields for Monad CMS
Sometimes items in an admin will require a slug. Slugs are URL-enabled versions of plain text, e.g. the title of a blog post. In other words, given the following blog post:
My awesome blog!
...we would need to generate this slug for SEO-friendly links:
My awesome blog!
This plugin automates that process for you, optionally allowing the author to override the generated slug.
Installation
NPM
$ npm install --save monad-slug
var monad = ;var monadSlug = ; angular;
Bower
$ bower install --save monad-slug
<!-- Optionally use the .min.js versions in production: -->
angular;
Usage
Slugs require a source field. Let's say your model is like so:
var blogPost = title: 'My awesome blog!' slug: '';
In the schema view, you could then write this:
Title: Slug:
The directive now watches the title
for changes, and updates the ngModel
specified on the form element with the new slug.
Use a hidden element or the disabled
attribute to prevent authors overriding
the generated slug.
Todo/wishlist
- Support for checking slug uniqueness via an API