diff --git a/lib/jekyll-maps/google_map_api.js b/lib/jekyll-maps/google_map_api.js index d9564b8..58126e2 100644 --- a/lib/jekyll-maps/google_map_api.js +++ b/lib/jekyll-maps/google_map_api.js @@ -80,7 +80,7 @@ var jekyllMaps = (function() { title: location.title, image: location.image, icon: location.icon || mapOptions.markerIcon, - url: location.url.length > 0 ? mapOptions.baseUrl + location.url : '', + url: markerUrl(mapOptions.baseUrl, location.url), map: map }) if (mapOptions.showMarkerPopup) marker.addListener('click', markerPopup) @@ -88,6 +88,12 @@ var jekyllMaps = (function() { return marker } + function markerUrl(baseUrl, url) { + if (/^(https?|\/\/)/.test(url)) return url + + return url.length > 0 ? baseUrl + url : '' + } + function markerPopup() { var contentHtml = '
' + this.title + '
'