Lektor template filter to convert geojson objects to Leaflet maps
pip install lektor-leaflet-geojson
Import the leaflet JS and CSS. You can skip this step if you are managing Leaflet yourself (e.g: with NPM)
{{ import_leaflet('1.7.1') }} {# using a specified version #}
{{ import_leaflet() }} {# default to "latest" #}
The |map()
filter can be used to render a GeoJSON feature on a map. Pass some inline CSS to style the map div.
{{
'{"type": "Feature", "geometry": {"type": "Point", "coordinates": [125.6, 10.1]}}' | map("height: 300px; width: 300px;")
}}