jekyll-get-json
💎 Import remote JSON data into the data for a Jekyll site
Installation
- Use
bundle add jekyll-get-jsonto add this to your site's Gemfile. - Add this plugin to the
pluginslisted in your_config.ymlfile. For example:plugins: - jekyll-get-json
Usage
Add a jekyll_get_json section to your _config.yml file. This section should be an array of objects containing data and json properties:
- The
dataproperty specifies where in thesite.datayou would like to put this data. - The
jsonproperty is the remote URL of the JSON file.
To illustrate an example, assuming that you have a remote JSON file at https://example.com/data.json containing this:
{
"bar": "Success!"
}
And you put the following into your _config.yml file:
jekyll_get_json:
- data: foo
json: 'https://example.com/data.json'
Then in your Jekyll site you will be able to use:
{{ site.data.foo.bar }}
And you will see:
Success!
Credit
This plugin is basically a more limited version of jekyll-get, duplicated here purely for the purposes of making it a Ruby gem.