Created
February 3, 2021 15:07
-
-
Save morgyface/df963aef55867844b01004114374717a to your computer and use it in GitHub Desktop.
Nunjucks | sanitize | replace whitespace with hyphens
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set image = profile.name | lower | replace(" ", "-") %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nunjucks and sanitize_title_with_dashes
I failed in my search for a built in nunjucks filter which mimics the WordPress function
sanitize_title_with_dashes
.However, I did discover if you combine
lower
withreplace(" ", "-")
you can get pretty close without too much fuss.