Streaming live at 10am (PST)

Dynamic CMS Map - Solved with Dynamic Embeds, Examples in Post


#1

What would be really handy for a project I'm planning at the moment would be a way to set a street location/address in a collection item, then to be able to dynamically insert that into the map object.


#2

Hi @oramsdesign

You can add dynamic map to Webflow CMS. All you have to do is use rich text element for one of dynamic fields and add "Media" element inside it.

Then you add link from google maps there

And get map inside the dynamic item

Sure it is not the same as simply add address, but working awesome as a workaround.

Regards,
Anna


Can maps reference an address in a CMS collection?
#3

Hi @sabanna
Hadn't thought of that. That will definitely be a handy workaround thanks!


#4

@sabanna

With the addition of the new Dynamic Embedding, I've been able to make a dynamic map embed for CMS posts.
Here's how to do it:

Firstly, you will need to log in to the Google Developer's Console, create a new project for your website, then in the API manager, activate the Google Maps Embed API. You will need to copy the API code that's generated as that will be needed for the embed.

Next we go back to webflow.
In your posts collection where you want the maps to be, add a plain text field for typing in the address.

It's important that when the address is typed that instead of using spaces, you use the plus (+) symbol as shown in the image above.

Then either in a dynamic list, or in a collection page template, use the HTML embed item and input the following code:

I've blurred out my API code, and that's where you need to paste yours. And the "Google Maps Address/Location" is the plain text field we created for the address.

Here's the results of the test I did setting this up:


And that's all there is to it. Custom Maps in CMS can be added with just typing a single line into a plain text field.
Hope this is helpful to someone.


#6

Hello @oramsdesign

I tried this tutorial and everything went just fine until I saved the embed code, I got this message

The funny thing is that I used the API key that I created specifically for this project. Any thoughts?


#7

Thanks for the tips!
However, I’m getting the same results as @aaronocampo, @oramsdesign. :frowning:
Any additional thoughts on this?


#8

I am having the same issue. Anyone figure it out how to do properly?


#9

In the end I simply put in custom code that inserts a map (not using the key method) but also inserts the actual map view code from a CMS item using the maps.google.com embed method.
Visit a location on Gmaps, click share, click “use embed method” find the code after the “?”. There’s a little trickery but I think you’ll get the hang of it. :wink: