README
Restaurant sites data
This repo holds and documents data source plugins for a set of example sites.
In order to maximise the opportunity for re-use, each data source will present its data to the build in an agreed JSON structure. In this way, any SSG or framework will be able to present the content from any data source we add in future as long as it conforms to this spec.
Table of contents
- Content source plugins
- Demo site implementations
- Using a plugin in your site
- Data API and schema
- Building additional content source plugins
Content source plugins
Find each of these in this repo:
- Contentful
- Sanity (WiP)
- Airtable (coming later)
- More sources (or should I say "sauces"?! Anyone? Hello? No?) TBD
Demo site implementations
The following example sites which use these data sources are available. Each site is intended to be functionally identical but implemented with a variety of frameworks and data sources.
Contentful | Sanity | Airtable | |
---|---|---|---|
Nuxt | repo, demo | repo, demo | repo, demo |
Next | repo, demo | repo, demo | repo, demo |
11ty | repo, demo | repo, demo | repo, demo |
Astro | repo, demo | repo, demo | repo, demo |
Using these plugins in your site
These plugins are collected and packaged as an NPM package for convenience. Install and save to your site's config with:
npm install -s @netlify/demo-restaurant-sites-data`
Then specify in your site's netlify.toml
file which data source plugin you wish to use:
[[plugins]]
# package = "./node_modules/@netlify/demo-restaurant-sites-data/plugins/{PLUGIN_DIRECTORY}"
package = "./node_modules/@netlify/demo-restaurant-sites-data/plugins/contentful"
[plugins.inputs]
# Directory for the generated JSON data files to reside in
dataDir = "data"
Data API and schema
Each Build Plugin provides a data abstraction to a different content source. When the build runs, the specified plugin will request the data from the content source and save it to the build cache ready for the SSG to use, according to the structure described below.
Menu
A set of menu items with descriptions and metadata
Resource location: /data/menu.json
[
{
"title": "Teetering Taco Tower",
"description": "A massive and frankly distressingly large tower of tacos with every filling you can imagine, and far more tacos than you need",
"price": INTEGER,
"currency": "