philsturgeon / awesome-earth

"What can I do about the climate crisis?" Here are 326 things you can do.

Home Page:https://protect.earth

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

links.yaml data

michaelsbach opened this issue · comments

Hi, all. I am new to open-source and Gatsby (as well as React to a certain extent) so I apologize if this is out of place.

I am curious as to how the data in data/links.yaml is able to be used in the components/RecentLinks. It seems like "links" is a global variable of some sort, defined by the base keyword "links" in the yaml file. Would this be a feature of Gatsby, or is there maybe a config js folder that itemizes the ENV/global variables?

EDIT: I was also trying to assign this Issue with a label of "question" but I wasn't able to find the button to do that.

Hey @michaelsbach! This is done in a fairly conventional way for a Gatsby site, but its alien if you're new to it. I was recently in your shoes :)

In gatsby-node.js we create the links property

links: linksForThisCategory,

This links property is then accessible in the RecentLinks component. Not global, just passed through.

It's basically this https://www.gatsbyjs.org/tutorial/part-seven/

If you have any questions feel free to start off a PR and see how far you can get, I'll be more than happy to help you out with contributions even if we gotta do some learning on the way!