size

v1.9.1

Returns the number of characters in a string or the number of items in an array.

Input

1
{{ "Ground control to Major Tom." | size }}

Output

1
28

Input

1
2
3
{% assign my_array = "apples, oranges, peaches, plums" | split: ", " %}

{{ my_array.size }}

Output

1
2
3


4

You can use size with dot notation when you need to use the filter inside a tag:

1
2
3
{% if site.pages.size > 10 %}
This is a big website!
{% endif %}