Create a publishing target
A publishing target consists of a database and a publishing target definition item that specifies that database. Sitecore publishes from the Master database to one or more publishing target databases. The Master database contains all versions of all data, including unapproved content changes.
The default publishing target, Internet, references the database named Web, but you can create additional publishing targets.
Reasons to create additional publishing targets include:
- Geographic distribution: you can publish all content to multiple publishing targets on content delivery servers in multiple locations.
- You want to publish to a preview publishing target before publishing to your live site.
To create a publishing target:
-
Deploy a new database, for example by using the
Webdatabase from the installation package for your version of Sitecore. -
In the
ConnectionStrings.configfile on your CM server, add an entry similar to this:NoteTo use the database for content delivery instead of preview, add a connection on your CD server.
-
Create a configuration patch file similar to this (the settings are in the
Sitecore.configfile):NoteThe
<modulesFilePath>parameter specifies an additional path from which Sitecore loads module-provided item resources for this database. Include it when the database needs those resources. If no module resources are needed, omit it; a configured path that does not exist can generate a resource-loader warning. -
In the
App_Data\items\folder, make a copy of theWebfolder. -
Rename the copy of the folder and the
.datfile inside it. Use the database name for the folder (for example,web_preview) and use the database name within the file name, so it is similar toitems.web_preview.dat). -
Some additional steps are required if installed modules such as SXA use the
sitecore modules\items\folder. If you have SXA installed, perform steps a and b. If you have other modules installed that use thesitecore modules\items\folder, perform step a:- In the
sitecore modules\items\Â folder, make a copy of theÂwebfolder. - Rename the copy of the folder and the
.datfile inside it. Use the database name for the folder (for example,web_preview) and use the database name within the file name, so it is similar toitems.web_preview.sxa.dat.
- In the
-
If you need a search index for the new database, copy the one for
sitecore_web_indexin theApp_Config\Sitecore\ContentSearch\Sitecore.ContentSearch.Solr.Index.Web.config, and change it so that the crawler uses the new database. You must also change the index update strategy to get data from the new database. -
To create a new index update strategy, copy the existing
onPublishEndAysncorOnPublishEndAsyncSingleInstanceindex update strategy, give it a new name, for example,onPublishToPreviewEndAsync, and change the database parameter of the strategy to the name of the publishing target.