← Back to all Resources

Integrating map functionality with the CMS

Custom code
Integrations

Existing work/examples

The good news is that Mapbox plays really well with Webflow and there are a lot of examples of customers building with Mapbox and Webflow. Some examples: 

CMS Mapbox (Made by Corey from our Brand Team)

CMS Map with Info Card

United States of Coffee

Mapbox Scrollytelling Cafe Map

Voyage of the Beagle

Potential solutions

Given Webflow is just an abstraction of HTML and CSS, it’s completely possible to build this in Webflow. Here are two potential approaches:

CMS Sync

Custom code

One option would be to sync your live data to Webflow. This would mean the data isn’t live up to the second, but you could set this to run hourly or at whatever interval works best for the team. 

The advantage with this approach is that the data that’s opened in the modals would load much faster than on the current site. It looks like it’s currently making API calls on click, fetching data, and then writing it to the DOM. 

With this approach, the content would already be living in the Webflow CMS and would allow your team all the power to design and build with the Designer and with less reliance on custom code. 

To accomplish this, you could look at our Webflow Examples Github and the repo Populate Data into Webflow CMS. You can view the repo here: 

https://github.com/Webflow-Examples/populate-data-into-webflow-cms

The code in the above repo is available under an MIT license and shows an example of loading content in the CMS. You could work off this example and set this to update existing items, create new items, and delete old items on a regular basis. 

In this example, we’re loading in movies, but you could use this for your own data as well. 

// make the call to Webflow to add the movie
return webflowApi
  .createItem({
    collectionId: "6353176f2cf2501b7755dae3",
    fields: {
      name: movie.title,
      "movie-id": movie.id,
      genres,
      "movie-backdrop-poster": MOVIE_BACKDROP_PATH + movie.backdrop_path,
      "movie-poster": MOVIE_IMAGE_PATH + movie.poster_path,
      "release-date": movie.release_date,
      "release-year": getYear(parseISO(movie.release_date), 1),
      overview: movie.overview,
      "vote-average": movie.vote_average,
      "vote-count": movie.vote_count,
      popularity: movie.popularity,
      trailer: "https://www.youtube.com/watch?v=" + movie.trailerKey,
      _archived: false,
      _draft: false,
    },
  })
  .then((res) => console.log(res.name))
  .catch((err) => console.log(err));

The upside of this approach is that, again, it gives you the ability and power to work using the Designer, but the downside is that you’ll need to spin up a resource (Node server or similar) to run this function regularly to keep your data up to date.

Automation tool with UI

If procurement is possible and security allows it, you can also use tools like Parabola or Whalesync to do this as well. If you’d like to know more about this, please let me know and I’ll dive deeper into these options. But this means you don’t need to write code or build your own Node server or infrastructure.  

Fetch on page load

An additional approach to use would be to do this the exact same way you’re currently approaching it. 

Use Webflow to build your page and keep the data where it currently exists. You can build the designs in Webflow and use JavaScript to fetch data and write it to the DOM when a user clicks on a location.

We do have a couple repos that walk through how to do this if you need the guidance on how this is done when you’re building with Webflow, but my guess is that since you’ve built this once you have what you need. 

GitHub repos: 

One of these (Fetch API and Write) shows fetching and writing to the DOM as usual. The Greenhouse Jobs example shows how you can clone an item you developed visually in the Designer, clone it, and update the content. 

Either approach would work and it would allow you to re-use a lot of the work you’ve already completed on the current site. 

Additional tooling

I did mention additional tooling on the call, but I left that out since you’re using Mapbox. Reusing what already exists will allow you to move with speed and save you a lot of time with migrations, procurement, etc.

I’m happy to have additional conversations around this though if you are interested. 

Related resources

Retrieving UTM Parameters and Adding Hidden Inputs to Forms

Captures UTM parameters as hidden form inputs for campaign tracking via form submissions.
Developer
Video
Custom code
Forms
Marketing

Saving and Retrieving User Input with Local Storage

How to save and retrieve user input on a form from/to local storage and show it on a thank you page.
Developer
Video
Custom code
Forms
Marketing

Using an iframe on the page

Performance and accessibility considerations when using iframes
Developer
Article
Accessibility
Performance
Custom code
Security

Creating your own middleware

A guide to creating middleware to protect your API keys when making front-end calls in Webflow
Developer
Github
Custom code
API

Dialog element for modals and popups

Build more accessible pop up elements by using the dialog element with custom elements in Webflow
Developer
Nugget
Accessibility
Custom code

Custom code workflows

Methods for working with custom code in Webflow
Developer
Article
Custom code

Dynamic no-index tag for CMS template pages

Apply no-index tags to specific CMS items
Marketer
Video
CMS
Custom code
SEO

Migrate from the legacy Hubspot app to new Hubspot app

Steps to migrate from the legacy hubspot integration to the new Hubspot app
Marketer
Nugget
Integrations

Link to specific tab using the tabs element

Low-code solution to link to specific tab with the native Webflow tab element
Developer
Video
Custom code

Adding social share links to collection template page

Low-code method of adding social media share links to CMS pages
Developer
Video
CMS
Custom code