altrdev / hugo-leaflet Goto Github PK
View Code? Open in Web Editor NEWHugo Shortcodes for inserting a OSM Map, Marker or Track into your posts by using leaflet
License: MIT License
Hugo Shortcodes for inserting a OSM Map, Marker or Track into your posts by using leaflet
License: MIT License
Hugo Version: hugo v0.88.1-5BC54738+extended linux/amd64 BuildDate=2021-09-04T09:39:19Z VendorInfo=gohugoio
Created a template to use as a single page to display a map with markers for a website I am designing, and finding this repository was a god send. But, when I entered the shortcode to create a map into my template, I received the error:
parse failed: template: map.html:29: unexpected "<"
The shortcode was the standard: {{< leaflet-map mapHeight="500px" mapWidth="100%" mapLat="27.66995" mapLon="85.43249" >}}
as provided in the README.md as an example. The output from the error is referring to the two <>
at the beginning and end of the shortcode directly within the two {{ }}
, in other words from {{< ... >}}
.
So I remove them, and then receive the next error.
parse failed: template: map.html:29: bad character U+002D '-'
I am assuming that the use of the < >
is intended to escape the -
, but does not appear to be doing so. I was wondering if this comes from a change in the hugo template syntax, or if there is someway to prevent receiving this error and get the things working.
Cheers.
Copy the assets folder over
I donΒ΄t see any assets folder within this project?
Using the sample
{{< leaflet-map mapHeight="500px" mapWidth="100%" mapLat="27.66995" mapLon="85.43249" >}}
renders like this:
The problem seems to be that the normal bottom right about leaflet/copyright section overlays the whole map. I can hover over the urls at the very top left corner (about 1px is visible)
Any way to fix this?
The map itself shows up fine, but the track does not. My console is showing the following issue:
Uncaught TypeError: Cannot read properties of undefined (reading '_container')
at i._addToChartDiv (leaflet.elevation.js:628:38)
at i.addTo (leaflet.elevation.js:182:18)
at drawTrack (leaflet.hugo.js:62:56)
I have tried for a few weeks now to nail it down but I just don't have the JS abilities to debug it. I'm almost certain I'm doing something stupid here but cannot figure it out.
Anybody else come across this?
Hi,
I try to use your library (thanks a lot fo your work) but I wasn't able to move forward the first explications.
shortcodes files
in theme>layouts>shortcodes
, JS files
in theme>assets>js
,images
in my-project>assets>images
min.css file
in my-project>public>css
{{ partial "leaflet-loader" . }}
in the html page of my project i wanted to work on{{ if .HasShortcode "leaflet-map" }} {{ partial "leaflet-loader" . }} {{ end }}
but when I pasted {{< leaflet-map mapHeight="500px" mapWidth="100%" mapLat="27.66995" mapLon="85.43249" >}}
in my .md content file I have this error in my console: failed to unmarshal YAML: yaml: line 7: could not find expected ':'
I guess I'm doing something wrong but I can't find what... It's the first time I use Hugo and Leaflet and now I'm quite lost :)
Can you help me please ?
Attempting to get this library to render a map and so far it has not worked out. This might be an issue that is specific to the hugo theme that I am incorporating. It facilitates postcss.js, which could be preventing the library from loading.
First off, I am unsure whether the library's files should be placed within the theme or within the site itself. You mentioned modifying the partial head.html, but did not clarify if we are to modify and save it to site/layouts/partials
or whether we are to save it to site/themes/ourtheme/layouts/partials
. The same for the css, imgs, and js. Do they belong in the theme or in the site, and do the js files need to be placed in /assets/js
or in /static/js
?
I have tried both ways and all at once, and the best that I receive is an error output that resembles "leaflet.elevation.{{$HASH}}.js
cannot be loaded".
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.