All integrations MapLibre Leaflet OpenLayers React Vue Svelte Angular React Native WordPress Webflow Squarespace Wix Shopify API docs

Add a map to your Webflow site

Show visitors where to find you with a fast OpenStreetMap map, pasted into a Code Embed element. No Google account, no card, and about five minutes of work.

Before you start

  • A Webflow plan that allows custom code. The Code Embed element needs either a paid Site plan on the site, or a paid Workspace plan (Core, Growth, Agency or Freelancer). On a free Starter site with a free Workspace the element is greyed out. See Webflow's Custom code embed help article.
  • A free ExpressMaps API key. Sign up (no card), then copy a key from Console → Keys.
  • Your location as longitude and latitude. The easiest way is our map embed generator: drag and zoom to your shop, double-click to drop the marker, and it writes the numbers into the code for you.

Step 1: Copy the map code

Replace YOUR_API_KEY with your key, and the two sets of numbers with your location. The numbers go longitude first, then latitude: [-0.1276, 51.5072] is London. If your map shows up in the sea off Africa or in Antarctica, the numbers are the wrong way round.

<link rel="stylesheet" href="https://unpkg.com/maplibre-gl@4.7.1/dist/maplibre-gl.css">
<script src="https://unpkg.com/maplibre-gl@4.7.1/dist/maplibre-gl.js"></script>
<div id="map" style="width:100%;height:400px;"></div>
<script>
  var map = new maplibregl.Map({
    container: "map",
    style: "https://tiles.expressmaps.com/styles/standard.json?key=YOUR_API_KEY",
    center: [-0.1276, 51.5072],
    zoom: 13
  });
  map.addControl(new maplibregl.NavigationControl());
  new maplibregl.Marker()
    .setLngLat([-0.1276, 51.5072])
    .setPopup(new maplibregl.Popup().setText("Our shop"))
    .addTo(map);
</script>

Rather not edit code by hand? The embed generator produces exactly this snippet (the HTML (MapLibre) tab) with your style, position, marker and key filled in.

Step 2: Add a Code Embed element in Webflow

  1. Open your site in the Designer and go to the page where the map belongs, for example your Contact page.
  2. Open the Add panel (the plus icon in the left toolbar) and find Code Embed in the Advanced section.
  3. Drag it onto the page, ideally inside a Section, Container or Div block so it lines up with the rest of your layout.
  4. The code editor opens. Paste the snippet, then click Save & Close.
  5. Click Publish and open your site's webflow.io staging address or your live domain to see the map.

The Designer shows a placeholder box rather than running scripts, so the map itself only appears in Preview or on the published site. If Preview shows nothing, publish to staging and check there.

Step 3: Restrict your key to your domain

Your key is visible to anyone who views the page source. That is normal for web maps; the domain restriction is what stops other sites from using it.

  1. Go to Console → Keys and open your key.
  2. Under Key Restrictions, type a domain without https:// or a path, for example www.yourbusiness.com, and click Add Restriction.
  3. Add each address the map is viewed on as its own entry: yourbusiness.com, www.yourbusiness.com, and your Webflow staging address such as your-site.webflow.io.
  4. Click Save Changes. The restriction applies to new requests shortly after saving.

Once a key has restrictions, a page on any other domain gets a "403" error instead of the map, so keep the list up to date if you add or change domains.

Troubleshooting

  • An empty grey or white box. Almost always the key. Check that you replaced YOUR_API_KEY, and that the exact domain in your browser's address bar (including or excluding www.) is in the key's restriction list. Staging on webflow.io counts as a separate domain.
  • Nothing at all, no box. The map has no height. Keep height:400px in the snippet; a percentage height such as 100% only works if the parent element has a fixed height too.
  • The map is in the wrong place. Longitude and latitude are swapped. MapLibre wants [longitude, latitude].
  • Code Embed is greyed out. The site needs a paid Site plan or the Workspace needs a paid plan (see above).
  • Two maps on one page, only one works. Each map needs its own id. Change id="map" and container: "map" to map2 in the second snippet, and rename var map to var map2 in it.
  • The map works on staging but not the live domain (or the other way round). Add both to the key's restrictions.

Things to know

  • Is it really free? Yes. The free plan includes 100,000 map loads a month, commercial use allowed. One map load is one page view that shows the map; panning and zooming do not count.
  • Do I need a cookie banner for the map? Not for the map itself: the map sets no cookies and does not track your visitors. Other tools on your site may still need consent.
  • Can I change the look? Replace standard in the style address with any of the ten styles: basic, enhanced, darklands, greyscale, navigator, subtle, autobahn, lithium or mulberry.
  • Can I show more than one branch? Yes, for a handful of locations copy the four new maplibregl.Marker() lines once per address and change the numbers and popup text.
  • The page scrolls into the map on phones. Add cooperativeGestures: true, after zoom: 13,. Visitors then use two fingers (or Ctrl and scroll on desktop) to move the map, and normal scrolling moves the page.
  • Do I have to keep the "© OpenStreetMap" credit? Yes, the data licence requires it, and the map adds it automatically.
  • Is there a shorter version? Our expressmaps helper needs a little less code. After the two MapLibre lines, add <link rel="stylesheet" href="https://unpkg.com/expressmaps@1.0.1/dist/expressmaps.css"> and <script src="https://unpkg.com/expressmaps@1.0.1/dist/expressmaps.umd.js"></script>, then use the snippet below.
<div id="map" style="width:100%;height:400px;"></div>
<script>
  expressmaps.createMap({ container: "map", key: "YOUR_API_KEY", center: [-0.1276, 51.5072], zoom: 13, marker: { popup: "Our shop" } });
</script>

Get a free API key Open the embed generator