Number of values in a field
Fill in your field nameItalic values are placeholders: replace them with your own machine names, or let the builder do it.
Raw entity
Open in builder (Raw entity)Reads the entity directly, before field formatters run.
- Twig
{{ node.field_name| length }}
Render array
Open in builder (Render array)Reads the content render array, after field formatters run.
- Twig
{{ content.field_name['#items']| length }}
Gotcha
Methods like count() are blocked by Drupal’s Twig sandbox; the length filter works because field item lists are countable. For the first item use .0.