SharedConfigPlugin

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

Namespace Shared Configs

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.

Priority

This plugin runs with a priority of 3.

Options

PropertyDescription
filenamethe name of the JSON file output by the plugin

Adding to Mosaic

Add the following to the plugins collection:

plugins: [
  {
    modulePath: '@jpmorganchase/mosaic-plugins/SharedConfigPlugin',
    options: {
      filename: 'shared-config.json'
    },
    priority: 3
  }
  // other plugins
];
Mosaic BETA

Coming soon