Manually configure the sites in a multisite application

By default, the Next.js Multisite add-on fetches a list of site information directly from your Sitecore instance, and all sites are statically generated at build time.

In some situations, you might want to reduce the number of statically generated sites or specify which sites to include in your multisite JSS Next.js application.

You can apply both procedures simultaneously.

Configure a subset of sites for static generation

All sites are statically generated by default at build-time, but you can configure the Multisite add-on to generate only a subset of sites statically.

To change the list of statically generated sites:

  • In the root directory of the Next.js application, in the src\lib\sitemap-fetcher\plugins\graphql-sitemap-service.ts file, for the sites parameter, provide a list of specific site names. For example:

    ['foo', 'bar']

Ensure all sites passed to the MultisiteGraphQLSitemapService options are on your Sitecore instance.

If a site (either passed manually or inherited from the JSS_APP_NAME environment variable) does not have a content tree, the static generation will fail for all sites.

See how the SiteResolver generates site lists in a JSS Next.js app with the Multisite add-on for more information.

Override the JSS site configuration for all sites

The Next.js Multisite add-on sets the JSS config sites at build-time in the provided JSS config plugin defined in the /scripts/config/plugins/multisite.ts file.

By default, a multisite-enabled application fetches site information (type SiteInfo) directly from Sitecore using the GraphQLSiteInfoService service, but you can provide a list of sites instead.

To override or set the list of sites:

  • Provide the list of sites to the SITES environment variable as an array of JSON-formatted objects matching the SiteInfo type. For example:


This method is suitable for a small number of sites. For a more extensive list, you can modify the plugin to retrieve sites from another source, such as a static JSON file instead.

Do you have some feedback for us?

If you have suggestions for improving this article,