Using an Address in Twig

# Example

This is a very simple example of what is possible with the Address field...

{# Show a formatted address #}
{{ address.multiline() }}

{# Display map with a marker #}
{{ mapbox.map(address).tag() }}
Example using the address of the Empire State Building

# Breaking it down

Each Address field returns an Address Model, which is extremely powerful and flexible. The example above is relying on several distinct features of the Address Model...

  • We used multiline to display a complete address, formatted across multiple lines.
  • We used mapbox.map to show the location as a marker on a map.

To get a better understanding of the various methods available, take a look at the Address Model documentation.

To learn how to render a map, check out the Dynamic Maps documentation to see what is possible.