Closed niallthompson closed 8 years ago
You can use marker.addressComponents instead.
Output {{ dump(marker.addressComponents) }}
and you'll see the full array.
In your particular case, you'd probably have to do something like:
{% for part in marker.addressComponents %}
{% if part.types[0] == 'postal_town' %}{{ part.long_name }}{% endif %}
{% endfor %}
Just for reference, you can also use {{ marker.formattedAddress }}
.
Using {{ marker.address }} in my template is there a way to just get the city or locality?
For example: London or Los Angeles.
This is my current markup:
{% for marker in entry.location.getMarkers() %}{{ marker.address }}{% endfor %}