0.3.1 • Published 4 years ago

@developersgarage/sourcebit-target-eleventy v0.3.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

sourcebit-target-eleventy

[npm version

A Sourcebit plugin for the 11ty static site generator

👩‍🏫 Introduction

This plugin creates a JavaScript file (_data/data.js) to expose any Sourcebit data source through JavaScript properties consumable by the 11ty static site generator.

🏗 Installation

To install the plugin and add it to your project, run:

npm install sourcebit-target-eleventy --save

💡 You don't need to run this command if you start Sourcebit using the interactive setup process, as the CLI will install the plugin for you and add it as a dependency to your project.

⚙️ Configuration

The plugin accepts the following configuration parameters. They can be supplied in any of the following ways:

  • In the options object of the plugin configuration block inside sourcebit.js, with the value of the Property column as a key;
PropertyTypeVisibilityDefault valueEnv variableParameterDescription
contentModelsString ArrayPublicfalseA list of strings representing the content model names to be included as part of the data object used to create the pages

👀 Example configuration

sourcebit.js

module.exports = {
    plugins: [
        {
            module: require('sourcebit-target-eleventy'),
            contentModels: ['blog', 'about']
        }
    ]
};

🧞‍♂️ Interactive setup process

This plugin offers an interactive setup process via the npx create-sourcebit command. It asks users to select each of the content models present in the models data bucket to be accessbile within 11ty.

📥 Input

This plugin expects the following data buckets to exist:

  • models: An array of content models
  • objects: An array of objects with data corresponding to the models

📤 Output

This plugin creates creates a JavaScript (data.js) file in the _data folder.

Analytics