Currently, I am reading in data into a javascript with the following:
let locations = {{ .Site.Data.network.members }}
and everything works fine.
However, I would like to make these into webpages that people could visit - and still read this data into JS script and work with it like before. This has evaded me. I have tried several variations, the only one that doesn’t crash Hugo (so far) is:
let locations = {{ where .Site.Pages "Type" "network" }}
but the data doesn’t load - I get a JS error Uncaught TypeError: locations.reduce is not a function
But I all I did is tried to read in the data, I haven’t called any other step.
If someone can help me move forward that would be appreciative.
I can share my leaflet javascript if that helps.
The current data file looks like:
members:
- name: Efeca
description: >-
Efeca, a Dorset based micro natural resources company, provides
specialised consulting advice on responsible sourcing, sustainable trade
and use of natural resources including palm oil, timber, soya, sugar and
coffee. A Tropical Forest Alliance partner & World Economic Forum
preferred supplier. Efeca has accumulated broad experience working in over
30 countries, across agricultural and forest risk commodities.
webSite: http://www.efeca.com
email: lucy.cullinane@efeca.com
image: /uploads/efeca.png
group: Sustainability
latitude: 50.7488
longitude: -2.3445
popupText: >-
Efeca, a Dorset based micro natural resources company, provides
specialised consulting advice on responsible sourcing, sustainable trade
and use of natural resources including palm oil, timber, soya, sugar and
coffee.
The new page / data source looks like:
---
title: Efeca
name: Efeca
type: network
webSite: http://www.efeca.com
email: lucy.cullinane@efeca.com
image: /uploads/efeca.png
group: Sustainability
latitude: 50.7488
longitude: -2.3445
popupText: >-
Efeca, a Dorset based micro natural resources company, provides
specialised consulting advice on responsible sourcing, sustainable trade
and use of natural resources including palm oil, timber, soya, sugar and
coffee.
---
Efeca, a Dorset based micro natural resources company, provides
specialised consulting advice on responsible sourcing, sustainable trade
and use of natural resources including palm oil, timber, soya, sugar and
coffee. A Tropical Forest Alliance partner & World Economic Forum
preferred supplier. Efeca has accumulated broad experience working in over
30 countries, across agricultural and forest risk commodities.