A plugin is software that can be added to a Koji after publication to provide additional functionality. Basically, it allows for the injection of dynamic code. Plugins can only be added by the creator of a Koji. They will not be passed down to remixes.
Generally, a creator customizes a plugin for a particular Koji by specifying values for one or more fields. For example, the Custom Boilerplate plugin adds a pop-up window requiring a user to acknowledge a licensing agreement before interacting with the Koji. The creator specifies the body text and the question text for the pop-up window.
In addition to allowing the creator to easily add functionality to a Koji, plugins offer a few other advantages.
Search engines and social crawlers often do not render JavaScript when indexing pages. For instance, if you’re using React, a bot may only see the root div and an "enable JavaScript" message. A plugin can overcome this limitation by injecting keywords into a webpage’s header. Because Koji plugins are computed server-side, they are available to all bots without any additional configuration or third-party services.
A plugin can inject a new file at runtime, simplifying the creation of things like web app manifests. The plugin provides configurable values, and the injection wraps them with the relevant code.
Koji plugins are not designed to modify template functionality or to inject code that interfaces with a template’s native code. This is an intentional decision to avoid code fragmentation. Meaningful changes to functionality should be done within the code of the template, and repeated core behaviors should leverage JavaScript packages and the larger JavaScript community.
Plugins are only injected into static services.
If your template contains multiple static services, plugins will be injected into all of them. There is no way to enable or disable plugins on a per-service basis.
Open the Koji and click the Koji button.
Go to Manage this Koji > Open Creator Dashboard > Configure Plugins.
Choose a plugin from the list of available plugins.
Configure and enable the plugin.