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

Metadata

When building your site, Trio generates a collection of metadata objects that it creates from your project's assets and configuration file. Trio organizes this metadata, making it easy to reason about, and exposes it to your project's tag-based callbacks through the site and asset properties which can then be used to add dynamic content to your site's pages.

After each build of your project, Trio persists most of the metadata that it has collected to a file named root/trio.manifest.json. You can view the contents of this file to assist you when coding tag-based callbacks.

Below is an inventory of the metadata that is available to you.

Please note that beginning with v1.0.0-rc.5, Trio no longer generates a unique id property for fragments due to the expense in terms of the development time required to maintain their integrity during incremental builds. In its place, you should now use the fragment's url property, which is guaranteed to always be intrinsically unique per fragment.

Prior to v4.0.0, depending on your site's fragment assets, both the site argument and the trio.manifest.json file may not have include one or more of the following properties: frags, wipsCount, wips, articlesCount,articlesCatalog, tagsCatalog, and categoriesCatalog. Beginning with v4.0.0, Trio now assigns meaningful default values for all these properties.

site

Exposes the global collection of metadata objects for the entire project. See Tag-Based Callbacks - Argument Properties for more information..

site.timestamp

The date and time of the current build in "YYYY-MM-DD HH:MM:SS" format.

site.version

The version of Trio used to build the project in semantic versioning format.

site.buildType

Either "development" or "release".

site.userConfig

The contents of the root/trio.json file.

site.frags

An array of all non article fragments. See fragment below for details.

site.wipsCount

An integer, the site's total number of "work in progress" fragments.

site.wips

An array of all the "work in progress" fragments. See fragment below for details.

site.articlesCount

An integer, the total number of blog articles.

site.articlesCatalog

Only relevant for projects that have articles. Is an array that catalogs the site's blog article's in ascending alphabetical order by article date and article title. See fragment below for details.

site.categoriesCatalog

Only relevant for projects that have articles that have categories. Is an array that catalogs the site's blog articles in ascending alphabetical order by category.

site.categoriesCatalog[nth]
.category

The article's category.

site.categoriesCatalog[nth]
.related

An array of related articles in descending alphabetical order by article date and article title.

site.categoriesCatalog[nth]
.related[nth].articleDate

The date of the article in "YYYY-MM-DD" format.

site.categoriesCatalog[nth]
.related[nth].url

The article's URL.

site.categoriesCatalog
.related[nth].title

The article's title.

site.categoriesCatalog
.related[nth].excerpt

The article's excerpt.

site.tagsCatalog

Only relevant for projects that have articles that have tags. Is an array that catalogs the site's blog articles in ascending alphabetical order by tag.

site.tagsCatalog[nth]
.tag

The tag.

site.tagsCatalog[nth]
.related

An array of related articles in descending alphabetical order by article date and article title.

site.tagsCatalog[nth]
.related[nth].articleDate

The date of the article in "YYYY-MM-DD" format.

site.tagsCatalog[nth]
.related[nth].url

The article's URL.

site.tagsCatalog
.related[nth].title

The article's title.

site.tagsCatalog
.related[nth].excerpt

The article's excerpt.

site.dataCatalog

A hash that catalogs the site's JSON data files in root/source/data along with their content. Each property in the hash represents a single JSON data file. See JSON Data for more information.

asset

Exposes the metadata object associated with the composite's fragment asset. See fragment below and Tag-Based Callbacks - Argument Properties for more information..

fragment

An object that contains all the metadata associated with a fragment.

You can access the current fragment in your tag-based callbacks using the callback's asset property. You can access all non article fragments in your tag-based callbacks using the callback's site.frags property. You can access all article fragments in your tag-based callbacks using the callback's site.articlesCatalog property.

.path

The path to the fragment file in the source/fragment folder. It is used internally by Trio during page generation.

.mtimeMs

The timestamp that represent the time, in milliseconds, when the fragment was last modified. It is used internally by Trio to determine the files to be included when building incrementally. See Incremental Build for more information.

You can also use mtimeMs for showing the date and time your pages were last updated.

$tag.append(new Date(asset.mtimeMs).toLocaleString());

.type

A string that indicates the type of the fragment. It is used internally by Trio for determining the paths of dependencies between project assets when building incrementally.

.isStale

A boolean that indicates if the fragment was marked as stale. It is used internally by Trio when building incrementally.

.matter

The fragment's front matter. See Front Matter for more information.

.destPath

The path to the page in the public folder.

Beginning with v1.0.0-rc.5, destPath is now generated in all lowercase.

.url

The URL of the page.

.collection

Only relevant for fragments that are part of a collection. See Collections for more information. Introduced in v2.0.0.

.articleDate

Only relevant for articles, is a string which contains the date of the article in "YYYY-MM-DD" format.

.nextArticleUrl

Only relevant for articles, is the URL to the next article.

.previousArticleUrl

Only relevant for articles, is the URL to the previous article.

Only relevant for articles that have categories, is an object that catalogs other articles related to this article by its category.

.relatedArticlesByCategory
.category

The article's category.

.relatedArticlesByCategory
.related

An array of articles related to this article in descending alphabetical order by article date and article title.

.relatedArticlesByCategory
.related[nth].articleDate

The date of the article in "YYYY-MM-DD" format.

.relatedArticlesByCategory
.related[nth].url

The article's URL.

.relatedArticlesByCategory
.related[nth].title

The article's title.

.relatedArticlesByCategory
.related[nth].excerpt

The article's front matter's excerpt.

Only relevant for articles that have tags. Is an array that catalogs other articles related to this article by its tags. Catalog items are in ascending alphabetical order by tag.

.relatedArticlesByTag[nth]
.tag

The tag.

.relatedArticlesByTag[nth]
.related

An array of articles related to this article by fragment.relatedArticlesByTag[nth].tag in descending alphabetical order by article date and article title.

.relatedArticlesByTag[nth]
.related[nth].articleDate

The date of the article in "YYYY-MM-DD" format.

.relatedArticlesByTag[nth]
.related[nth].url

The article's URL.

.relatedArticlesByTag[nth]
.related[nth].title

The article's title.

.relatedArticlesByTag[nth]
.related[nth].excerpt

The article's excerpt.

An array that catalogs all other articles related to this article and is similar to fragment.relatedArticlesByTag but flattened for when you aren't concerned about each related article's tag.

.relatedArticlesByTagFlattened[nth]
.articleDate

The date of the article in "YYYY-MM-DD" format.

.relatedArticlesByTagFlattened[nth]
.url

The article's URL.

.relatedArticlesByTagFlattened[nth]
.title

The article's title.

.relatedArticlesByTagFlattened[nth]
.excerpt

The article's excerpt.

See Also