AsheAvenue/Kilt — pull request #30 by darrencauthon (2014-07-03 14:48:23+00:00)
Title: Slug prefixes

Depending on the app that's built with Kilt, there might be some "ancillary" objects -- small CRUD objects that will populate dropdowns, provide groups, etc., but never be exposed as public URLs. They're still Kilt objects, though, and they will be provided a unique slug.

Their slug can get in the way, though. Here's a story:

Setup:

```yaml
page:
fields:
name: text
body: tinymce
blog_category:
slug_prefix: 'blog-category'
fields:
name: text
```

> A user creates a blog category called "Alternative Energy" The blog category (which will never be exposed as a page) is slugged as "alternative-energy". Then the user creates a page called "Alternative Energy" with the intention of the page being exposed as a URL. But since the blog category took up "alternative-energy", the public page gets the nasty-looking "alterative-energy-19287319273" URL.

I thought a quick way to take care of this potential problem is to allow a conditional ```slug_prefix``` value on an object. If this slug prefix exists, and system-generated slugs will prepend ```slug_prefix``` to the slug. So in the story above, the blog category would get "blog-category-alternative-energy' and the page would get "alternative-energy".

Thoughts, concerns? I wanted to document this as well, but I didn't see a good place to do it beyond putting it in a default file. Later on we should talk about documenting this app, I know it well now and think I can help.