The $TagPlugin powers the tags feature of Mosaic.

This plugin scrapes $tag from page metadata and also applies all aliases stored in config.data.tags.

Tags ultimately resolve down into refs, but are different from normal refs, in that they are applied to the union filesystem (all merged filesystems), not to the individual source filesystem that they were defined on. This can be thought of as a global ref.

Other plugins can use config.setData() and modify the tags property, to apply new global refs, as long as they do so before this plugin has reaches $beforeSend.

This plugin runs with no special priority but it must run before both the $AliasPlugin and the $RefPlugin.

Let's assume there is a products page on your site and each product is shown as a tile. The information for each product tile is sourced from multiple Mosaic sources. How can tags be used to reference the product data needed for each tile on the products page?

The product page should add a $tag metadata prop to its frontmatter:

The tag shown in the example above is saying populate data.items of the Products index page with the data metadata property of pages tagged with product.

A tagged product page needs to have a tags property which is a collection of tags and one of these needs to be product. This will allow the $TagPlugin to correctly associate the product page to the product index page. It will also need a data property because thats the property our product index page wants to use for the tiles.

Mosaic BETA

Coming soon