forked from wragge/lodbook-ed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaces.html
51 lines (45 loc) · 1.23 KB
/
places.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
layout: entities
title: Places
---
<style>
#map {
width: 100%;
height: 400px;
margin-bottom: 20px;
background-color: grey;
}
</style>
<div id="map"></div>
<script>
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
mapTypeId: google.maps.MapTypeId.TERRAIN
});
var marker;
var bounds = new google.maps.LatLngBounds();
{% for place in site.data.places %}
{% if place.data.geo %}
latlng = new google.maps.LatLng({{ place.data.geo.latitude }}, {{ place.data.geo.longitude }})
marker = new google.maps.Marker({
title: "{{ place.name }}",
position: latlng,
map: map
});
google.maps.event.addListener(marker, 'click', function () {
window.location.href = '{{ place.name | slugify}}/';
});
bounds.extend(latlng);
{% endif %}
{% endfor %}
map.fitBounds(bounds);
}
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAKirUd8aZPsiObFFH7c-hv5P1jpvBjaeQ&callback=initMap">
</script>
<ul>
{% for place in site.data.places %}
<li><a href="{{ place.name | slugify}}/">{{ place.name }}</a></li>
{% endfor %}
</ul>