Skip to content

Instantly share code, notes, and snippets.

@gjhead
Created August 13, 2020 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gjhead/106e8c8faee46caadf1ad2936d452758 to your computer and use it in GitHub Desktop.
Save gjhead/106e8c8faee46caadf1ad2936d452758 to your computer and use it in GitHub Desktop.
You obviously need to make sure your fields match up - but this will take an address and turn it into a link to a google map.
{{ entry.eventLocation.streetAddress1 }}<br>
{% if entry.eventLocation.streetAddress2 | length %}{{ entry.eventLocation.streetAddress2 }}<br>{% endif %}
{% if entry.eventLocation.city %}{{ entry.eventLocation.city }}, {% endif %}{% if entry.eventLocation.state %}{{ entry.eventLocation.state }}{% endif %}{% if entry.eventLocation.zipCode %} {{ entry.eventLocation.zipCode}}{% endif %}</p>
<a class="link" href="https://www.google.com/maps/search/?api=1&query={{ entry.eventLocation.streetAddress1|escape('url')}}{% if entry.eventLocation.city %}%20{{ entry.eventLocation.city|escape('url') }}{% endif %}{% if entry.eventLocation.state %}%20%2C{{ entry.eventLocation.state|escape('url') }}{% endif %}{% if entry.eventLocation.zipCode %}%20{{ entry.eventLocation.zipCode|escape('url') }}{% endif %}" rel="nofollow" target="_blank">Get Directions</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment