Creating a custom Publish plugin
You can create custom Publish plugins to meet specific needs and requirements. Follow the best practices and use the Publish plugin creation example as guidelines for this task.
- Choose the category of the plugin. For example, if you want the plugin to be triggered after the files are exported to the file system, you need to create a plugin that implements the
IPublishPostProcessinterface. - Choose the interface to implement. When writing a new custom plugin, you should implement one of the available interfaces:
- Implement the
IPublishPostProcesswhen your plugin needs to be called after the files are exported to the file system. This is currently the only supported Publish plugin.
- Implement the
- Implement Initialize. Here the plugin should read its parameters and parse their values. In case a value is invalid, the plugin sequence can fail early in the process, before any plugin is executed.
- Implement Run. Here you put the main logic of the plugin. Anything that plugin can do is available to it through the context, which includes:
- The object that was used to start the publish
- Information of where the content and metadata files were exported, so they can be accessed
- The condition set used
- Output format fields
- Whether the publish needs to compare versions
- Whether the publish needs to combine multiple languages into one output result
- Logging (Use LogService property of the context to add the logging statement to the standard application log file)
- Expose the plugin using the Export attribute to make sure that the plugin engine can discover the plugin.