Coding
The sportclimbs.uk site uses the Hugo static site generator to build the content files and templates into a web site.
The site has various custom functions described here.
Maps
The maps used are by Leaflet JS, a javascript library.
To add a map to a page add the two variables to the frontmatter: map
and markers
.
The map
variable sets 2 things:
- the centre of the map and also
- the zoom level
The markers
variable sets the position of a marker and text to appear when the marker is clicked.
1map: [52.993516, -4.392794, 15]
2markers:
3- [52.98158, -4.39739, Parking]
4- [52.993516, -4.392794, Trefor]
With a list of markers only the last one will display it’s name. In the above example the marker will display Trefor. The other markers need to be clicked on first.
Getting the coordinates
You can get coordinates from Open Street Map. Find the point you want on the map and click with the right mouse button. From the flyout menu click show address. The coordinates appear in the left hand margin.
You can also convert Ordinance Survey map coordinates into latitude and longitude coordinates using an online conversion tool.