decap-cms icon indicating copy to clipboard operation
decap-cms copied to clipboard

feat(slugs): allow filters in template strings

Open stormwarning opened this issue 2 years ago • 4 comments

Process template filters first, then strip ' and . characters from slug strings.

Fixes #4783

Summary

Provides greater control over field values used in entry slug strings.

Test plan

Added a new formatters test which failed under the existing setup. Updated compileStringTemplate() function such that new test and all existing tests pass.

Checklist

  • [x] I have read the contribution guidelines.
  • [x] Code is formatted via running yarn format.
  • [x] Tests are passing via running yarn test.
  • [ ] The status checks are successful (continuous integration). Those can be seen below.

image

stormwarning avatar Feb 10 '23 04:02 stormwarning

Also happy to update the docs if the rest of the code looks good 👍

stormwarning avatar Feb 10 '23 04:02 stormwarning

Deploy Preview for decap-www canceled.

Name Link
Latest commit 2645e07808c579426127b9b4e1aa94aef57d822e
Latest deploy log https://app.netlify.com/sites/decap-www/deploys/648a76a5465c0e000830810b

netlify[bot] avatar Mar 08 '23 17:03 netlify[bot]

Could really use this feature, hopefully it gets approved and merged!

jenniferbhampton avatar Mar 20 '23 23:03 jenniferbhampton

If this allows use setting for example our own slug filter, it would be awesome.

For example:

slug: {{title | my_own_slugify}}

nhoizey avatar Mar 16 '24 19:03 nhoizey