Trio Icon
Trio v6.1.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

Your Financial Support Of This Project Is Greatly Appreciated

Trio is an open source project and is therefore free of charge to use both for noncommercial and commercial use, but when you use Trio to create a new website, please consider donating a few bucks. It doesn't take very long, the process is secure, and it will allow us to continue to support the community and to maintain and enhance Trio going forward.

Show your ❤️, add your ★ to the Github repo.