I’ve had this idea about a simple extension for awhile now, and have finally gotten around to building it and wanted to share it with the community. The problem I wanted to solve was simple; replicate publish & unpublish transactions which are sent from specific source publications, to a set of target publications. In this post I’ll outline what I’ve built, how it works and how you can leverage or extend it for your projects.
The problem I wanted to solve was simple; replicate publish & unpublish transactions which are sent from specific source publications, to a set of target publications
The problem the extension should solve
I was working on an implementation which had a common web publication intended for creating pages and structure groups that would be shared across a set of child web publications representing local language websites.
Referencing the blueprint image down below, pages and structure groups were created in 400 Web Master, but there was no published website for that publication. Instead, the items were inherited in the 500 level web publications which do have local language websites. In my specific scenario we wanted to keep all sites at the 500 level in sync. If a page is published to one site, it must also be published to other sites.
The scenario I built the extension for
The site is maintained in English, but translated and published to the other local language websites. It’d be nice to be able to replicate publishing transactions from the English website, to the master website publication, and force the “publish to child publications” advanced publish setting which would publish the item to all language sites.
That was the problem that I ran into that I thought warranted this extension, but it’s built generically enough for any other scenarios where you would want to mirror publishing & unpublishing. It would be simple to extend this extension to only mirror publishing of items of specific schema, in an organizational element etc.
There are also a bunch of other use cases:
- Keeping two specific websites (publications) in sync
- Publishing items sent from Experience Manager to other websites automatically
How the extension is built
I settled on an event-handler extension for the following reasons:
- Easy to setup accompanying DLL configuration file to make the extension configurable and reusable
- Easy to hook into publish transactions sent to the queue
- User experience is optimal in the sense that each mirrored transaction is represented in the queue and obvious to the user
The extension is pretty simple. The extension:
- Checks if the publication for the item being published is defined in the list of source publications in configuration
- If the publication is in the list, get the list of targets publications defined in configuration
- The extension also attempts to retrieve the item being published, and all resolved items, in the target publications for publish mirroring
- Finally the extension publishes the items in the target publications to the same publishing targets as in the original publish / unpublish transaction (using the same instructions)
Note: It’s important to understand that the publishing & unpublishing instructions used in the original publish / unpublish event are used for the mirror publish events. If the user sends an item with priority high in a source publication, the item will also be published with priority high in the target publication(s).
You can override some of the advanced publishing options in the configuration.
Configuring the extension
The extension ships with an accompanying configuration file which allow the extension to be configured.
- The source publications to watch for publish transactions to be mirrored
- The target publications to mirror publishing transactions in
- Force advanced publish settings including publish to child publications
- Force publishing minor versions
Check out the GitHub page for full configuration details.
Deploying the extension
The instructions for deploying the extension are detailed on GitHub, but deploying Event-System extensions is super easy if you haven’t deployed one in the past. You simply need to drop the DLL and configuration files, and update an XML file with the path to the file.
Check out the GitHub page for full deployment details.
Downloading the extension
The extension is released on GitHub. Feel free to download it and extend it, or submit any updates via a pull-request.
I’m a 28 year old web developer from Halifax, NS. When I’m not throwing out random quotes from The Office, you can probably find me hacking away on my PC or spending time with my fiance and two year old Doodle. I’ve been focusing lately on React and Java EE but I can never avoid the temptation of a new technology. Always striving to get better.