Skip to main content Link Menu Expand (external link) Document Search Copy Copied

How to display nearby locations

Display a list with the 5 closest locations

{% assign sorted_locations = locations | sort:"distance" | where_exp:"loc","loc.distance > 0" %}
{% for loc in sorted_locations limit:5 %}
  {{ loc.name }} - {{ loc.distance | distance_to_human }}
{% endfor %}