Learn

_ampersand_sentence_list

Create a sentence-like list of values using ampersands.

The _ampersand_sentence_list shortcut will turn a simple YAML list into a sentence-like list using ampersands instead of “and.”

If the list contains one item, this will return just that item. If the list contains two items, this will return both items with an ampersand between them. If the list contains three or more items, this will return a comma-separated list with an ampersand before the last item.

Sample Usage

Input

categories:
  - technology
  - zoology
  - survival skills

Tag

{{ categories_ampersand_sentence_list }}

Displayed Result

technology, zoology & survival skills

This article was last updated on March 30th, 2016. Find an error? Please let us know!