Sentence List Modifier#
Turn a simple array into a friendly comma delimited list with the word "and" before the last item.
things:- batman- zombies- scrunchiesyamlyaml
I like {{ things | sentence_list }}.antlersantlers
I like batman, zombies, and scrunchies.htmlhtml
By default, the "glue" is the word "and", and will be translated appropriately. But, you can change it with the first argument:
I like {{ things | sentence_list('&') }}.antlersantlers
I like batman, zombies, & scrunchies.htmlhtml
The second argument controls the oxford comma. Set that to 0 and it'll get removed:
I like {{ things | sentence_list('and', 0) }}.antlersantlers
I like batman, zombies and scrunchies.htmlhtml
Docs Feedback
Submit improvements, related content, or suggestions through Github.
Betterify this page