Trio Icon
Trio v5.0.0
Documentation is evolving and is a WIP

JSON Data

Trio exposes the individual JSON files it finds in the root/source/data folder to your project's tag-based callbacks through the metadata site.dataCatalog object.

  • file location: root/source/data
  • file type/content: .json/JSON

As an example, the file root/source/data/personalization.json

{
	"name": "John Doe",
	"socialMedia": "@johndoe"
}
Example: JSON Data File personalization.json

would be exposed to tag-based callbacks as site.dataCatalog.personalization:

module.exports = ({ $page, site }) => {
	$page("#name").append(site.dataCatalog.personalization.name);
	$page("#social-media").append(site.dataCatalog.personalization.socialMedia);
}; 
Example: Tag-based Callback Using dataCatalog

See Also