Linking to a separate Google Map page
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.
# Generating a link to a Google map page
<a href="{{ entry.myFieldHandle.googleMapUrl }}">Open in Google Maps</a>
# Generating a link for directions
{# Set destination with no starting point #}
<a href="{{ entry.myFieldHandle.directionsUrl }}">Directions in Google Maps</a>
{# Automatically detect user's starting location #}
<a href="{{ entry.myFieldHandle.directionsUrl }}&saddr=Current+Location">Directions in Google Maps</a>
The directionsUrl
method has up to three optional parameters:
directionsUrl(destinationTitle, startingTitle, startingAddress)
Parameter | Description |
---|---|
destinationTitle | Title of the destination marker. |
startingTitle | Title of the starting marker. |
startingAddress | An instance of another Address model. A path will be calculated between the two locations. |
Titles may not always appear
Depending on the browser and usage, the destinationTitle
and startingTitle
may or may not be utilized.