Eleventy Plugin Add Remote Data screenshot

Eleventy Plugin Add Remote Data

Author Avatar Theme by Ashur
Updated: 3 Jan 2024
14 Stars

Fetch remote data from one or more URLs and expose each response as an Eleventy global data variable

Overview

The Eleventy Plugin for adding remote data is designed to simplify the process of retrieving and managing JSON data from various endpoints within your Eleventy projects. By exposing these responses as global data variables, it allows developers to seamlessly integrate external data into their templates with minimal effort. This plugin is particularly useful for those who frequently fetch similar data, as it streamlines the setup process and reduces redundancy.

Utilizing the robust capabilities of @11ty/eleventy-fetch, this plugin not only supports default caching and type handling but also offers configurable options for both global and individual data variables. Its clever design addresses common pain points associated with managing remote data, providing a user-friendly approach for developers looking to enhance their Eleventy sites with dynamic content.

Features

  • Global Data Variables: Easily define one or more global data variables to access remote JSON data across templates, simplifying data management.

  • Customizable Caching: The plugin caches responses for one day by default, with options to modify the cache duration and storage directory to suit specific project needs.

  • Individual Endpoint Options: Fine-tune settings for each global data variable independently, allowing for tailored configurations without altering global defaults.

  • Support for JSON and More: Assumes valid JSON responses by default, but you can switch to other types supported by eleventy-fetch for flexibility in handling diverse data formats.

  • Security and Privacy Compliance: Emphasizes the importance of reviewing cached responses to maintain privacy and security, recommending the addition of the cache folder to .gitignore.

  • Streamlined Setup: Greatly reduces setup friction for projects that handle identical global data files, enhancing productivity by minimizing repetitive code.

  • Alternative Use Case Guidance: Offers insight into when it’s better to use this plugin versus directly using eleventy-fetch, ensuring users choose the right tool for their specific requirements.