A Netlify plugin to expose data collected to in the Netlify build cache to place and structure that Eleventy can use
NOTICE: This is an experimental feature. Subject to lots of change.
This plugin exposes data files gathered by previous operations into the Netlify build cache and exposes them to a destinations and format suitable for the Eleventy SSG to use in its templates at site generation time.
See this plugin being used with a plugin which gathers RSS feed data in this simplified demo site: https://demo-plugin-fetch-feed.netlify.com
This plugin is designed to be used in conjunction with other plugins which first gather content from remote sources and collect it in the Netlify build cache, such as netlify-plugin-fetch-feeds.
- npm and node
- @Netlify/build (later this will be included in the Netlify CLI)
- A free Netlify account
- Opt-in to Netlify Build Plugin feature support (Not yet publicly available, sorry)
This plugin can be included via npm. Install it as a dependency for your project like so:
npm install --save netlify-plugin-yield-data-for-eleventy
TODO
To use plugins, a plugins
array should be specified in your netlify.yml
. Each plugin can then be specified with its parameters like so:
plugins:
prime-eleventy:
type: netlify-plugin-yield-data-for-eleventy
config:
data_dir: src/site/_data
cache_sources: # An array of folders within the netlify cache where data should be sourced
- netlify-plugin-fetch-feeds
Once installed and configured, the plugin will automatically run in the Netlify CI during its specified Netlify Build lifecycle event.
To test the execution of the Netlify Build lifecycle locally, first ensure that netlify-build is installed:
# Ensure that you have the netlify build command available
# (in future this will be provided via the CLI)
npm install @netlify/build -g
# In the project working directory, run the build as netlify would with the build bot
netlify-build