deploy fixes
[wolnelektury.git] / src / references / templates / references / map.html
index a65224a..da3918b 100644 (file)
@@ -1,4 +1,5 @@
-{% extends "2022/base.html" %}
+{% extends "base.html" %}
+{% load cache %}
 {% load static %}
 {% load l10n %}
 
   <link rel="stylesheet" type="text/css" media="all" href="{% static 'contrib/leaflet-1.9.4/leaflet.css' %}">
   <link rel="stylesheet" type="text/css" media="all" href="{% static 'contrib/leaflet.markercluster-1.4.1/MarkerCluster.css' %}">
   <link rel="stylesheet" type="text/css" media="all" href="{% static 'contrib/leaflet.markercluster-1.4.1/MarkerCluster.Default.css' %}">
+  <meta property="og:type" content="website">
+  <meta property="og:title" content="Mapa Wolnych Lektur">
+  <meta property="og:image" content="{% static 'references/preview.png' %}">
+  <meta property="og:image:alt" content="Mapa miejsc w książkach na Wolnych Lekturach">
+  <meta property="og:image:width" content="1200">
+  <meta property="og:image:height" content="630">
+
 {% endblock %}
 
 
@@ -34,7 +42,7 @@
        });
    }
 
-   L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
+   L.tileLayer('https://tile.thunderforest.com/neighbourhood/{z}/{x}/{y}.png?apikey=a8a97f0ae5134403ac38c1a075b03e15', {
        attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
    }).addTo(map);
    var markers = L.markerClusterGroup();
        );
    }
 
+   {% cache 60 references-map %}
    {% localize off %}
    {% for e in entities %}
+   {% if e.lat and e.lon %}
+   edata = {{ e.get_json|safe }};
    L.marker(
-       [{{ e.lat }}, {{ e.lon }}],
+       [edata.location[0], edata.location[1]],
        {
-           title: "{{ e.label }}",
-           alt: "{{ e.label }}",
-           mid: {{ e.pk }},
+           title: edata.label,
+           alt: edata.label,
+           mid: edata.id,
        }
    ).on('click', showMarker).addTo(markers);
+   {% endif %}
    {% endfor %}
    {% endlocalize %}
+   {% endcache %}
 
    map.addLayer(markers);