Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Enhance slug control with field values as parameters #36

Open
jbmoelker opened this issue May 15, 2015 · 2 comments · May be fixed by #37
Open

Enhance slug control with field values as parameters #36

jbmoelker opened this issue May 15, 2015 · 2 comments · May be fixed by #37

Comments

@jbmoelker
Copy link

Currently an entity's slug is has two customisation options: Slug directory and Slug item prefix which support variables like #T:

Current slug control options

This still limits urls to a "flat" structure always having the same base slug directory. To create more meaningful urls, I would like to have extended url customisation with the support of an entity's field values. For this I would propose a syntax like :[field_name].
If for example I have a blog-post with a field named category, I would like to be able to use the value of this category in the url. I would be able to to this by entering :category as the slug item prefix, like so:

Field value as slug parameter

If I would now create a new blog-post naming it Highest buildings and selecting the category Architecture, this would result in the slug blog/architecture/highest-buildings.

This would also be a solution for i18n support in the front-end. In your entity's definition you could at a field for language. In the slug you could use :language/blog. Since this would be an entity property in the templates as well you can also use it to set the lang attribute in the HTML.

jbmoelker added a commit to jbmoelker/webhook-generate that referenced this issue May 15, 2015
`:[field_name]` in slug is replaced by the value of that field. For example `tutorials/:category` for an item which has selected 'HTML and CSS' as category would result in `tutorials/html-and-css`.

resolves webhook#36
@jbmoelker jbmoelker linked a pull request May 15, 2015 that will close this issue
@budparr
Copy link

budparr commented May 15, 2015

big +1 for this

@jbmoelker
Copy link
Author

@snide @LtSquigs have you had time to have a look at this? Currently involved in another project which could really benefit from this feature. Thanks in advance!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants