brockfanning / jekyll-get-json

Import remote JSON data into the data for a Jekyll site
MIT License
72 stars 17 forks source link

JSON data per page #7

Open mcnesium opened 4 years ago

mcnesium commented 4 years ago

What needs to be done to have the data be available per page instead of for the entire site?

I would like to access page-specific data from an API, so I tried to add this to the pages' frontmatter. E.g. a page for every group has data defined in a GitLab group, so I need to access the group-specific JSON URL per page:

jekyll_get_json:
  - data: group
    json: 'https://gitlab.domain.org/api/v4/groups/162'

This does not seem to work. I guess it would need a change in this line:

  config = site.config['jekyll_get_json']

So what can I exchange this with, to be able to configure the json URL separately on every page? Will this work at all or are pages' frontmatters only parsed after the plugin?

Sorry, I am not very well-trained in writing Jekyll plugins or even Ruby, and so I am only guessing…

edheltzel commented 3 years ago

https://github.com/avillafiorita/jekyll-datapage_gen