The Map Block allows you to add a map to any post or page on your site.
To use the map block, you need a Mapbox Access Token.
- If you don’t already have a Mapbox account, go to https://www.mapbox.com/signup/ and create a free account.
- Sign in to your Mapbox account.
- Go to https://www.mapbox.com/account/ and look for the Access Tokens section in the menu at the top.
- Copy the Default public token to your clipboard.
Adding the Map Block
You can add the Map Block to any post or page, by selecting it from the Jetpack section of the block picker:
See our Jetpack Blocks page for more information on adding Jetpack blocks.
If this is the first Map block you’ve added to your site, you’ll see a prompt to enter your Mapbox access token.
- Paste the Default public token you copied to your clipboard earlier into the token field in the Map block.
- Click Set Token.
The map will load with a text field for you to add a location marker.
Type the location you want to display on the map. This can be as general or specific as you wish, and the location will autocomplete as you type. Click the correct location to add it to your map.
You can then click on the red marker symbol to edit the title and caption of the marker.
Note that editing the address in the caption field here will not change the position of the marker, only what text is displayed on your map when the marker is clicked.
Adding Additional Location Markers
You can add additional location markers to the same map, for example if you have a chain of restaurants and you want to display all of their locations on one map.
To add a location marker, click the Add a Marker button and enter the location details as before.
When you add more than one location marker, the map will zoom out to display all markers.
Map Block Settings
When the Map block is selected, you’ll see some settings which can be customized in the sidebar.
To customize the appearance of your map, you can select the map theme, whether to show street names or not, and the color of the location markers.
The Markers section lets you edit all of your markers. Editing a marker here works exactly the same as if you click on the marker itself and edit there, but using these settings may be easier if you have a lot of markers to edit.
In the Mapbox Access Token settings, you can update or remove your Mapbox access token. Note that if you have multiple maps on your site, removing an access token from one map will remove it from all of your maps, but your location markers will be saved, so they will still be there if you add a new access token.
The Advanced settings allows you to add a custom CSS class to your map so that you can do your own custom CSS styling if desired.
If you’re having any trouble with the Map block, please contact support for help.