The SharedConfigPlugin
crawls the page hierarchy to find the closest sharedConfig
metadata from any parent index's page metadata. It then exports a JSON file into each directory with the merged config for that level.
Shared config is typically the place where the following is configured for a Mosaic site:
- App Header configuration including site name and main navigation
- Footer information
- Help links for the left sidebar area
Consider 2 sources the share the same namespace "product-docs":
- Source A - multiple product directories and main product index page. The index page specifies
sharedConfig
metadata. - Source B - pages relevant to a single product. Index page does not have any
sharedConfig
metadata.
Let's also assume that the pages from Source B would also naturally "fit" within the pages of Source B (e.g. inside a products directory).
In this scenario, the SharedConfigPlugin
will attempt to copy the shared config file from Source A into the root directory of Source B allowing the Source B pages to use the Source A sharedConfig
as though it were a product sourced directly from Source A.
This plugin runs with a priority of 3.
Property | Description |
---|---|
filename | the name of the JSON file output by the plugin |
This plugin is included in the mosaic config shipped by the Mosaic standard generator. So if you use the below import in your mosaic.config.mjs
file then the plugin is included already:
To add it yourself, add the following to the plugins
collection: