Jeff Wallace
Aug 10, 2012
  3797
(0 votes)

Multisite Publish Plug-in

Based on CMS 6 R2

Many EPiServer customers today have an enterprise environment allowing them to manage multiple sites from a single EPiServer instance with the possibility of sharing content and functionality between them.  In some cases this may be as simple as a main corporate site and a separate mobile site or the corporate Facebook page.  In other cases there may be many micro, or other, sites.

EPiServer’s out-of-the-box capabilities make sharing content between these sites extremely easy at the smaller content item level (e.g.  Property), the page level, etc.  When content is updated in the “master” location it is automatically reflected across others.  In some cases overriding at another level is also easily possible.

The request to publish an entire piece of content (e.g. a page) from one site to many others at the same time is becoming increasingly common,  and hopefully, I’m about to make it even easier.

Several months ago myself and a couple of colleagues were locked in a room coding up a storm for a demo and my old friend Paul Smith whipped up a module that utilized categories, a scheduled job, and some configuration in web.config to push content to different sites.  At the time this was exactly what we needed.  While considering this recently I decided to dig up the code and remove some of the complexities to simplify it.  The idea was to provide more of an “on demand” approach, removing the use of categories, but still providing the multisite publish feature.  So, here is is:

 

First, the web.config contains a new section that allows you to set up as many other site nodes as you want to be able to share content with.  This can be nodes on the same site, separate sites being managed by the same EPiServer instance, etc.  Give it a logical name, set the destination page ID, and optionally set Page Type you’d like it to use on the destination site.  If you don’t set a Page Type it will use the same type as the current page.

   1: <multisitepublishing>
   2:     <multisites>
   3:         <add name="Customer Zone News" destinationPageId="495" pageTypeName="[AlloyTech] News item"/>
   4:         <add name="Alloy Mobile News" destinationPageId="488" pageTypeName="[MobilePack] Standard Page"/>
   5:     </multisites>
   6: </multisitepublishing>

In Edit Mode, when a content item is selected, you’ll see a new tab with the “Multisite Publish” heading.  The site nodes listed in the config above will be presented as checkboxes in this UI.  To publish the current content item to these other locations simply check the ones you want to publish to and select the “Publish to Sites” button.

image

…and voilà, you’re done.  Simple!  A new content item will be created below the previously specified site nodes and will respect whatever styling is set for that area of the site.  You will note that the current implementation does not create a copy of the data but uses the Fetch Data feature in EPiServer to retrieve from the same data source.  This means an update to the content in the master location will result in a change reflected everywhere this content is being re-used.  Of course, you could change this to an alternate method of your preference, but re-using the content was the goal here.  As you probably know Fetch Data also lets you override individual content items on the fetching page when needed so this would still be possible here.

Customer Zone News:

image

Alloy Mobile News:

image

This could easily be extended with a fancier UI, the web.config settings replaced with a page selector property added in Edit Mode, a scheduling option, saving the state of the areas you published to, and much more.  However, I believe this is a great starting point for your multisite publish needs.

The tagging, shared Block, and Display Template features in the upcoming CMS 7 release will surely provide some enhanced possibilities.

Thanks to Paul Smith for providing the code to read the config, create the new content item, and fetch the data making my life much easier. Smile

How do you get it?

I’ve uploaded it to the EPiServer Nuget feed here.  You can also download the Nuget package here and install manually if you desire: Download.  The EPiServer Nuget feed is probably safest to ensure you get any updates that might come later.

Aug 10, 2012

Comments

Arild Henrichsen
Arild Henrichsen Aug 13, 2012 08:22 AM

This looks promising Jeff, can't wait to try it. I have a customer looking at different cross-publish possibilities now.

Aug 13, 2012 05:49 PM

Great to hear Arild!

Kjetil Simensen
Kjetil Simensen Aug 14, 2012 01:05 PM

Looks great!

Why not use GuiPlugIn settings to configure destination pages so that this can fully be controlled by the customer without having to access a config file on the server?

Aug 16, 2012 07:18 PM

Hi Kjetil, that's definitely a possibility and a great suggestion. This is intended to be a starting point for an idea that people can take and build upon. Making this configurable by the customer would be an excellent (and logical) next step.

Please login to comment.
Latest blogs
keep special characters in URL

When creating a page, the default URL segment validation automatically replaces special characters with their standard equivalents (e.g., "ä" is...

K Khan | Sep 19, 2024

Streamlining Marketing Success: The Benefits for Optimizely One with Perficient

As an Optimizely expert, I eagerly anticipate this time of year due to the exciting Optimizely events happening worldwide. These include Opticon, t...

Alex Harris - Perficient | Sep 17, 2024 | Syndicated blog

Creating an Optimizely Addon - Packaging for NuGet

In   Part One   and   Part Two   of this series; I covered topics from having a great idea, solution structure, extending the menus and adding...

Mark Stott | Sep 16, 2024

Optimizely CMS and weekly updates

Learn how reporting bugs in Optimizely CMS not only helps improve the platform but also benefits you and the entire user community.

Tomas Hensrud Gulla | Sep 12, 2024 | Syndicated blog

Introduce the ablility to select then delete items manually on FIND UI

In FIND 16.3.0 we introduce an ability to select items and delete them manually, it will helps you to delete unexpected items from the UI without a...

Manh Nguyen | Sep 12, 2024

The composable consulting model our industry needs

The architecture of a modern consulting business is ‘composable’. Certainly, we think of ourselves a composable consulting business and have done...

Mark Everard | Sep 12, 2024 | Syndicated blog