Launching Published Content Delivery Website URL for Page Items straight from Sitecore Content Editor

An efficient content authoring experience is crucial for the success of any Sitecore Implementation. Accelerating the authoring process by automating possible areas of authoring and publishing workflows, improves the efficiency of content authoring thereby helping content authors realize its exceptional value.

It is quite common that a content author will need to switch between CMS and Website to view/update content. Bridging the gap between CM and CD, allows seamless navigation and improves productivity.

Sitecore Powershell Extensions, makes this much easier with its Content Editor Integration Point and Invoke-JavaScript cmdlet. This blog covers the steps involved in setting up this Content Editor button.

STEPS TO CREATE POWERSHELL MODULE
Powershell Module(Eg: ‘Published Page Viewer’) can be created under /sitecore/system/Modules/PowerShell/Script Library using ‘Module Wizard’ Insert Option,

Ensure to select the ‘Content Editor’ Integration Point while creating the module,

Remove the items under Ribbon item except ‘Publish’. Build the following tree structure under ‘Published Page Viewer’ module item based on templates/insert-options indicated below,

  • Content Editor
    • Ribbon
      • Publish (PowerShell Script Library)
        • Publish (PowerShell Script Library)
          • View Published Page (PowerShell Script)

 

Below PowerShell Script shall be copied into the ‘Script body’ field of above created ‘PowerShell Script’ item,

IMPORTANT: Ensure that the Targethostname attribute of the site(s) in the site config (or Site Definition Item in case of SXA) holds the CD Domain, for this script to work as expected. If Targethostname doesn’t hold CD Domain, CD Domain can still be hard-coded in this script but not recommended. This script might need to be optimized if the default site resolving flow has been customized in the implementation.

Update the ‘Show Rule’ field in the Script Item to add ‘where the item has a layout’ rule, to ensure that the ‘View Published Page’ button appears only for page items.

Navigate to ‘PowerShell ISE’ from Sitecore LaunchPad. Select the ‘Settings’ tab and choose ‘Sync Library with Content Editor Ribbon’ from ‘Rebuild All’,

‘View Published Page’ option should now be available within the ‘Publish’ Chunk of the ‘Publish’ tab, using which Content Authors can navigate to respective CD URLs directly.

Happy Authoring!

Leave a Reply

Your email address will not be published. Required fields are marked *