Default Publish Settings in SDL Tridion


5 minute read

I was looking for a simple way to override and set some of the default publish settings in SDL Tridion, and would like to share the simple extension we wrote. It should be quite easy to extend to set other default publishing settings.


The problem

We were looking to set the Publish / Unpublish setting “Also Publish / Unpublish in Child Publications” to be checked by default. Out of the box, this setting is obviously unchecked however due to our BluePrint implementation we realized it would be advantageous to have this setting instead be checked by default so that items which are published from common Web Publications would be published to all child publications.


Our solution

We wrote a super simple GUI extension which I’d like to share.

SetPublishToChildrenDefault.js

We need to create an Event Handler which checks to see which display was opened, and if the pop-up is the publishing pop-up it will use jQuery to set the input checkbox. You can modify this code to set other Publish Settings.

$evt.addEventHandler($display, "start", onPublishSetDefaults);

// Event Handler to check off the advanced publish setting.
function onPublishSetDefaults () {
    $evt.removeEventHandler($display, "start", onPublishSetDefaults);

    if ($display.getView().getId() == "PublishPopup") {
        jQuery("#propagateInChildren").prop("checked", true);		
    }   
}

SetPublishToChildrenDefault.config

We need to create the configuration for the GUI extension, which we’ll reference in the Tridion System.Config file.

<?xml version="1.0"?>
<Configuration xmlns="http://www.sdltridion.com/2009/GUI/Configuration/Merge"
               xmlns:cfg="http://www.sdltridion.com/2009/GUI/Configuration"
               xmlns:ext="http://www.sdltridion.com/2009/GUI/extensions"
               xmlns:cmenu="http://www.sdltridion.com/2009/GUI/extensions/ContextMenu">

    <resources cache="true">
        <cfg:filters />
        <cfg:extensiongroups>
            <cfg:extensiongroup name="SetPublishToChildrenDefault">
                <cfg:extension target="Tridion.Web.UI.Controls.RibbonToolbar">
                    <cfg:insertafter>SetPublishToChildrenDefault</cfg:insertafter>
                </cfg:extension>
            </cfg:extensiongroup>
        </cfg:extensiongroups>
        <cfg:groups>
            <cfg:group name="SetPublishToChildrenDefault">
                <cfg:fileset>
                    <cfg:file type="script">SetPublishToChildrenDefault.js</cfg:file>
                </cfg:fileset>
            </cfg:group>
        </cfg:groups>
    </resources>
    <definitionfiles />
    <extensions>
        <ext:editorextensions/>
        <ext:dataextenders/>
    </extensions>
    <commands />
    <contextmenus />
    <localization />
    <settings>
        <defaultpage />
        <navigatorurl />
        <editurls/>
        <listdefinitions/>
        <itemicons/>
        <theme>
            <path/>
            <resourcegroup />
        </theme>
        <resourceextensions>
            <resourceextension>SetPublishToChildrenDefault</resourceextension>
        </resourceextensions>
        <customconfiguration/>
    </settings>
</Configuration>

Add the GUI extension to Tridion

Finally, we just need to update the System.Config file in the SDL Tridion install location to reference our new GUI extension.

  • Open SDL Web\web\WebUI\WebRoot\Configuration\System.config
  • Find the <editors> element and add the following editor to the configuration
<?xml version="1.0" encoding="utf-8"?>
<Configuration xmlns="http://www.sdltridion.com/2009/GUI/Configuration" xmlns:ext="http://www.sdltridion.com/2009/GUI/extensions">
  
  ...
  
  <!-- Editors settings. -->
  <editors default="CME">

    <!-- Customization -->
    <editor name="SetPublishToChildrenDefault">
      <installpath>C:\Program Files (x86)\SDL Web\web\WebUI\Editors\SetPublishToChildrenDefault</installpath>
      <configuration>SetPublishToChildrenDefault.config</configuration>
      <vdir>SetPublishToChildrenDefault</vdir>
    </editor>
    
    ...
  
  </editors> 
  
  ...
  
</Configuration>

Finally, scroll to the top of System.Config and increase the modification number to clear the cache on client machines.


Final Thoughts

You should now be able to open the Publishing Queue and see that the advanced setting is now selected by default. You could pretty easily extend the small JS snippet to set other publish settings.

Hope this helps! As always, feedback is welcome.