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
Web
database from the installation package for your version of Sitecore. -
In the
ConnectionStrings.config
file on your CM server, add an entry similar to this:RequestResponse<add name="preview" connectionString="Data Source=.;Initial Catalog=web_preview;User ID=;Password=" />
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.config
file):RequestResponse<?xml version="1.0" encoding="utf-8" ?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <eventing defaultProvider="sitecore"> <eventQueueProvider> <eventQueue name="web_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="web_preview" patch:after="store[@name='web']" prefix="web_secondary" 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> <!-- web_secondary --> <database id="web_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> <securityEnabled>true</securityEnabled> <dataProviders hint="list:AddDataProvider"> <dataProvider ref="dataProviders/main" param1="$(id)"> <disableGroup>publishing</disableGroup> <prefetch hint="raw:AddPrefetch"> <sc.include file="/App_Config/Prefetch/Common.config" /> <sc.include file="/App_Config/Prefetch/Webdb.config" /> </prefetch> </dataProvider> </dataProviders> <PropertyStore ref="PropertyStoreProvider/store[@name='$(id)']" /> <remoteEvents.EventQueue> <obj ref="eventing/eventQueueProvider/eventQueue[@name='$(id)']" /> </remoteEvents.EventQueue> <archives hint="raw:AddArchive"> <archive name="archive" /> <archive name="recyclebin" /> </archives> <cacheSizes hint="setting"> <data>100MB</data> <items>50MB</items> <paths>2500KB</paths> <itempaths>50MB</itempaths> <standardValues>2500KB</standardValues> </cacheSizes> </database> </databases> </sitecore> </configuration>
-
If you need a search index for the new database, copy the one for
sitecore_web_index
in 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
onPublishEndAysnc
orOnPublishEndAsyncSingleInstance
index 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.