Add Photo into Matinale
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
{{ if .IsNamedParams }}
|
||||
|
||||
{{ $mapLat := default "" (.Get "mapLat") }}
|
||||
{{ $mapLon := default "" (.Get "mapLon") }}
|
||||
{{ $zoom := default "13" (.Get "zoom") }}
|
||||
{{ $mapWidth := default "100%" (.Get "mapWidth") }}
|
||||
{{ $mapHeight := default "400px" (.Get "mapHeight") }}
|
||||
{{ $mapId := default (md5 (printf "%s%s" $mapLat $mapLon)) (.Get "mapId") }}
|
||||
{{ $scrollWheelZoom := default "true" (.Get "scrollWheelZoom") }}
|
||||
|
||||
<!--Container-->
|
||||
<div id='mapid_{{ $mapId }}' class="leaflet-map" style='width: {{ $mapWidth }}; height: {{ $mapHeight}};'></div>
|
||||
|
||||
<script>
|
||||
//Create Map
|
||||
leafletMapsObj[{{ $mapId }}] = L.map('mapid_{{ $mapId }}').setView([{{ $mapLat }}, {{ $mapLon }}], {{ $zoom }});
|
||||
{{ if eq $scrollWheelZoom "false" }}
|
||||
leafletMapsObj[{{ $mapId }}].scrollWheelZoom.disable();
|
||||
{{ end }}
|
||||
//Add tiles
|
||||
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||
}).addTo(leafletMapsObj[{{ $mapId }}]);
|
||||
|
||||
</script>
|
||||
{{.Inner}}
|
||||
|
||||
{{ else }}
|
||||
{{ errorf "Leaflet Hugo Shortcode: please provide named Parameters" }}
|
||||
{{ end }}
|
||||
@@ -1,32 +0,0 @@
|
||||
{{ if .IsNamedParams }}
|
||||
|
||||
{{ $markerLat := default "" (.Get "markerLat") }}
|
||||
{{ $markerLon := default "" (.Get "markerLon") }}
|
||||
{{ $markerContent := default "" (.Get "markerContent") }}
|
||||
|
||||
{{ with .Parent }}
|
||||
|
||||
{{ $mapLat := default "" (.Get "mapLat") }}
|
||||
{{ $mapLon := default "" (.Get "mapLon") }}
|
||||
{{ $mapId := default (md5 (printf "%s%s" $mapLat $mapLon)) (.Get "mapId") }}
|
||||
{{ $markerId := md5 (printf "%s%s%s" $mapId $markerLat $markerLon)}}
|
||||
|
||||
<script>
|
||||
//Marker
|
||||
leafletMarkersObj[{{ $markerId }}] = L.marker([{{ $markerLat }}, {{ $markerLon }}]).addTo(leafletMapsObj[{{ $mapId }}]);
|
||||
|
||||
{{ if $markerContent }}
|
||||
leafletMarkersObj[{{ $markerId }}].bindPopup("{{ $markerContent }}").openPopup();
|
||||
{{ end }}
|
||||
</script>
|
||||
|
||||
{{ else }}
|
||||
{{ errorf "Leaflet Hugo Shortcode: impossible using marker outside leaflet-map" }}
|
||||
{{ end }}
|
||||
|
||||
{{ else }}
|
||||
{{ errorf "Leaflet Hugo Shortcode: please provide named Parameters for marker" }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user