3. Most useful Volto settings – Volto Customization for JavaScript Beginners

Most useful Volto settings

3. Most useful Volto settings#

You can configure Volto by modifying settings in a js-file.

In our add-on we can modify the index.js

const applyConfig = (config) => {
  return config;
};

export default applyConfig;

Here three settings are changed:

const applyConfig = (config) => {
  config.settings = {
    ...config.settings,
    navDepth: 3,
    openExternalLinkInNewTab: true,
    hasWorkingCopySupport: true,
  };
  return config;
};

export default applyConfig;

Note

The ... is a use of the spread-syntax that "expands" the configuration into its elements and allows to change existing values and add new ones.

Note

If you instead make your changes in the project (i.e. not using a add-on) you make the same changes in the file config.js of the project.

Some of the settings are duplicates of settings that exist in the Plone backend. For example the setting supportedLanguages must match the one set in the Plone registry as plone.available_languages and in plone.default_language.

To configure Volto as a multilingual project you do this:

const applyConfig = (config) => {
  config.settings = {
    ...config.settings,
    defaultLanguage: "de",
    isMultilingual: true,
    supportedLanguages: ["en", "de", "fr"],
  };
  return config;
};

export default applyConfig;

See also

Multilingual

Here are some more setting you might use in your projects:

  • contentIcons - configure Content Types icons. See documentation.

  • navDepth - Navigation levels depth used in the navigation endpoint calls. Increasing this is useful for implementing fat navigation menus.

  • workflowMapping - Configure colors for workflow states/transitions - if you have a custom workflow or want to change the default colors.

  • openExternalLinkInNewTab - Kind of self-explaining, isn't it?

  • hasWorkingCopySupport - Enable if plone.app.iterate (Working Copy Support) is installed.

  • maxFileUploadSize - Limit the size of uploads

  • nonContentRoutes - A list of path strings which are considered to be outside of plone-restapi's content serialization. For example: /controlpanel, /login,/sitemap,/personal-information are all nonContentRoutes.

You can find all existing options in the file config/index.js of Volto itself which is available in your projects in frontend/core/packages/volto/src/config/index.js.

See also

Many options are explained in the Settings reference guide

You can not only change but also extend Volto here by extending existing configuration options or adding new ones.

For example here you add new blocks, customize existing blocks or configure what view/template is used when displaying a certain content-type.