How to use with a Matrix field

Smart Map has been replaced by Google Maps

Please install the Google Maps plugin instead. ➡️

As of February 2021, the Smart Map plugin has been completely rebuilt and replaced with the new Google Maps plugin for Craft CMS. For more details, see here...


The documentation below is for historical reference only.

Creating a map from a Matrix field is easy... If your Matrix field handle is myMatrixField, then your code would look something like this:

{% set entry = craft.entries.slug('my-awesome-entry').one() %}

{% set locations = entry.myMatrixField %}

{% set options = {
    height: 300,
    zoom: 3
} %}

{{ craft.smartMap.map(locations, options) }}

If you want to use only a single Matrix block, you can call a specific item from your locations array:

{{ craft.smartMap.map(locations[0], options) }}