By default, Sitecore publishes content from the master database to the web database. This covers most standard use cases, but there are scenarios — particularly around preview environments and staged publishing workflows — where you need content pushed to an additional database before it reaches the public web database.

A common example: you want non-Sitecore users (like a client or a QA team) to review content before it goes live. You can publish to a separate preview database first, accessible only through an internal preview URL, while the live site remains unaffected.

How to Add a New Publishing Target

Step 1 — Create the publishing target item in Sitecore

In the Content Editor, navigate to /sitecore/system/Publishing targets and insert a new publishing target item. Give it a meaningful name (e.g. Preview) and set the Target Database field to the name of the database you want to publish to — for example, preview.

Step 2 — Add the connection string

Open your Sitecore instance's ConnectionStrings.config file and add a new entry for the target database. The name must exactly match what you entered in the Target Database field:

<add name="preview"
     connectionString="Data Source=.;Initial Catalog=web_preview;
     User ID=youruser;Password=yourpassword" />

Step 3 — Create a configuration patch file

The cleanest way to register the new database with Sitecore is via a patch file. Create a new .config file under your project's App_Config\Include\ folder (following your project's architecture conventions). The patch needs to register the new database in three sections: eventing, PropertyStoreProvider, and databases.

Here's the patch template for a database named preview:

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <eventing defaultProvider="sitecore">
      <eventQueueProvider>
        <eventQueue name="preview"
          patch:after="eventQueue[@name='web']"
          type="Sitecore.Data.Eventing.$(database)EventQueue, Sitecore.Kernel">
          <param ref="dataApis/dataApi[@name='$(database)']"
                 param1="$(name)" />
          <param hint="" ref="PropertyStoreProvider/store[@name='$(name)']" />
        </eventQueue>
      </eventQueueProvider>
    </eventing>
    <PropertyStoreProvider>
      <store name="preview" patch:after="store[@name='web']"
        prefix="preview" getValueWithoutPrefix="true" singleInstance="true"
        type="Sitecore.Data.Properties.$(database)PropertyStore, Sitecore.Kernel">
        <param ref="dataApis/dataApi[@name='$(database)']" param1="$(name)" />
        <param resolve="true"
               type="Sitecore.Abstractions.BaseEventManager, Sitecore.Kernel" />
        <param resolve="true"
               type="Sitecore.Abstractions.BaseCacheManager, Sitecore.Kernel" />
      </store>
    </PropertyStoreProvider>
    <databases>
      <database id="preview" patch:after="database[@id='web']"
        singleInstance="true"
        type="Sitecore.Data.DefaultDatabase, Sitecore.Kernel">
        <param desc="name">$(id)</param>
        <icon>Images/database_web.png</icon>
      </database>
    </databases>
  </sitecore>
</configuration>

Step 4 — Create the physical database

The connection string references a database (web_preview in the example above) that must actually exist on your SQL Server. Create it in SSMS — either as a fresh empty database or as a copy of your existing web database if you want it pre-populated.

Step 5 — Verify

Restart your Sitecore instance to pick up the config changes. Navigate to the Publish dialog — your new publishing target should now appear in the Publishing Targets section alongside the standard Web target.

Use Case Tip

Publishing targets are especially powerful when combined with Sitecore workflows. You can configure a workflow so that content in a specific state automatically publishes only to the preview target — keeping your live site clean until final approval.

← Back to Blog Work With Us