Skip to main content

Clubs Plugins

Clubs Plugins are an important component of Clubs. By installing plugins in a Clubs and updating the configuration values, the functionalities of Clubs can be freely extended.

Extendable functionality includes layouts, pages, admin pages and slots.

Distributing plugins

Clubs is built on Node.js ecosystem, so to distribute plugins, they should be published as npm packages. See also Publish your plugin.

Plugin structure

Clubs Plugins must export the following interfaces from the main entry point by default export.

  • getPagePaths - Defines the page paths and its contents. This function is optional, but required if the plugin generates pages.

    This function is an asynchronous function that takes ClubsPluginOptions, ClubsConfiguration and ClubsFactoryUtils and returns ClubsStaticPaths.

  • getAdminPaths - Defines the admin page paths and its contents. This function is optional, but required if the plugin generates admin pages.

    This function is an asynchronous function that takes ClubsPluginOptions, ClubsConfiguration and ClubsFactoryUtils and returns ClubsStaticPaths.

  • getApiPaths - Defines the server-side APIs. This function is optional, but required if the plugin uses server-side logics.

    This function is an asynchronous function that takes ClubsPluginOptions, ClubsConfiguration and ClubsSlotsFactoryUtils and returns ClubsFunctionGetSlotsResults.

  • getSlots - Defines the slot contents. This function is optional, but required if the plugin injects slots.

    This function is an asynchronous function that takes ClubsPluginOptions, ClubsConfiguration and ClubsSlotsFactoryUtils and returns ClubsFunctionGetSlotsResults.

  • getLayout - Defines the layouts. This function is optional, but required if the plugin generates layouts.

    This function is an asynchronous function that takes ClubsPluginOptions, ClubsConfiguration and ClubsSlotsFactoryUtils and returns ClubsBaseStaticPath.

  • meta - An object that declares metadata such as the name, icon and identifier of the plugin. This is a required value for all plugins.

tip

The concrete structures for exporting these interfaces can be found in Publish your plugin.

Matrix

The following is a matrix of the functionalities provided by the plugin and the interfaces required for it.

PagesAdmin pagesServer-side APIsSlotsLayouts
getPagePaths✅ Required(optional)(optional)(optional)(optional)
getAdminPaths(optional)✅ Required(optional)(optional)(optional)
getApiPaths(optional)(optional)✅ Required(optional)(optional)
getSlots(optional)(optional)(optional)✅ Required(optional)
getLayout(optional)(optional)(optional)(optional)✅ Required
meta✅ Required✅ Required✅ Required✅ Required✅ Required