Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Feature Request] Add `slugify` Twig filter #5369

Open
benface opened this issue Dec 21, 2019 · 4 comments
Open

[Feature Request] Add `slugify` Twig filter #5369

benface opened this issue Dec 21, 2019 · 4 comments

Comments

@benface
Copy link
Contributor

@benface benface commented Dec 21, 2019

I see that craft\helpers\StringHelper::slugify() has been added in Craft 3.3.0. It would be nice if it was available as a Twig filter.

@michaelrog

This comment has been minimized.

Copy link

@michaelrog michaelrog commented Dec 25, 2019

FWIW — you can probably use the dasherize filter from Wordsmith until this gets added first-party.

@benface

This comment has been minimized.

Copy link
Contributor Author

@benface benface commented Dec 25, 2019

@michaelrog Thanks. Actually I use |kebab|ascii in the meantime.

@benface

This comment has been minimized.

Copy link
Contributor Author

@benface benface commented Jan 6, 2020

@brandonkelly Actually, it looks like |kebab|ascii does a better job at "slugifying" strings such as "Red/Green" (red-green) than craft\helpers\StringHelper::slugify() (redgreen).

@brandonkelly

This comment has been minimized.

Copy link
Member

@brandonkelly brandonkelly commented Jan 6, 2020

Yeah I don’t think we would call StringHelper::slugify() directly, as that is just a wrapper for the Stringy method, and not consistent behavior with actual slugs in Craft.

@brandonkelly brandonkelly self-assigned this Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.