Skip to content

philhawksworth/netlify-plugin-yield-data-for-eleventy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

netlify-plugin-yield-data-for-eleventy

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.

Overview

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.

Demonstration

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

Usage

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.

Prerequisites

  • 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)

Including this plugin in a project

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

Configuration

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

Execution in Netlify

Once installed and configured, the plugin will automatically run in the Netlify CI during its specified Netlify Build lifecycle event.

Executing locally

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

About

Make data from the Netlify build cache available to the Eleventy SSG

Resources

Stars

Watchers

Forks

Packages

No packages published