Zachary Kniebel menu home bio portfolio workbench blog contact
Zachary Kniebel
home bio portfolio workbench blog contact
blog
Creating a Preview Environment for your Content Authors in Sitecore
Posted on Aug 23, 2016
by Zachary Kniebel

It's not always easy for Content Authors to check their work using the Experience Editor or Sitecore's Preview feature, especially when using workflow. Sometimes, there's just no substitute for seeing the content on the site, itself. In this post, I will show you how you can easily set up a Preview environment for your Content Authors in a way that doesn't require any additional licensing and given the client the ability to even preview items not in the final workflow state.

What is a Preview Environment

A preview environment is exactly what it sounds like: a Sitecore site meant for previewing content. A Preview Environment is basically just a CD environment. Preview Environments differ from production environments in the following ways:

  • They do not require an additional Sitecore license (verify that this applies to you by checking the terms of your license or reaching out to your local Sitecore sales team)
  • They can be optionally configured to allow Content Authors to publish items not in the final workflow state to the preview target for viewing
  • They are never added to the public domain, so the general public never has access to see them
  • There is no need to worry about disabling access to the http://yoursite.com/sitecore path
  • There is no need to worry about removing the master database from your configuration

Like all CD environments, Preview Environments each have their own web database that is separate from the Production web database. Content Authors will see the Preview Environment in their list of publishing targets and can choose when to or not to publish there. Of course, this also means that there is no guarantee that the Preview Database will have all of the same content as the Production Web Database.

Walkthrough

The following steps are the minimum of what you will need in order to set up a Preview Environment.

Step 1: Add the Preview Database

Remember that the Preview Database is just another web database. Start by attaching another copy of the Web database for your Sitecore version to SQL and name it as desired. Next, add the following connection string to your App_Config/ConnectionStrings.config file, and update it with the necessary values.

    <add name="preview" connectionString="user id=user;password=password;Data Source=(local);Database=Sitecore_Preview" />

Step 2: Configure the Preview Database

Create a new patch file in your App_Config/Include folder named something like PreviewEnvironment.config and copy the below into it:

    <configuration>
      <sitecore>
        <database id="preview" singleInstance="true" type="Sitecore.Data.Database, 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>
          <proxiesEnabled>false</proxiesEnabled>
          <proxyDataProvider ref="proxyDataProviders/main" param1="$(id)" />
          <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>
          <Engines.HistoryEngine.Storage>
            <obj type="Sitecore.Data.$(database).$(database)HistoryStorage, Sitecore.Kernel">
              <param connectionStringName="$(id)">
              </param>
            </obj>
          </Engines.HistoryEngine.Storage>
          <NotificationProvider type="Sitecore.Data.DataProviders.$(database).$(database)NotificationProvider, Sitecore.Kernel">
            <param connectionStringName="$(id)"></param>
            <param desc="databaseName">$(id)</param>
          </NotificationProvider>
        </database>
      </sitecore>
    </configuration>

Step 3: Create the Publishing Target

Open up Sitecore and navigate to /sitecore/system/Publishing targets. Right-click the item and insert a child item from the Publishing Target template. Name it whatever you want, bearing in mind that this is the name that the Content Authors will know your Preview Environment by.

Shows where to create the Publishing Target item, under /sitecore/system/publishing targets

In the "Target database" field, supply the database id that you specified in your configuration file (should be the same as the name of your connection string). Optional: depending on how your client wants their Preview Environment to work, you can check the "Preview publishing target" checkbox. If checked, Content Authors will be able to publish items that are not in the final workflow state to their publishing target for previewing.

Shows the filled in fields on the new Publishing Target item

Step 4: Install a New Instance of your Site (CD)

Install a fresh instance of your site and configure it to use your "preview" connection string for its "web" database. You can install this instance on the same server or a different one, but it is important that you do not assign a public domain to point at the new instance. This is to make sure that you do not violate any Sitecore licensing terms. You can, however, assign a local or network-only domain to point at the new instance, should you so desire.

Even if you're load balancing your site's CD environment, it's likely going to be overkill to load-balance your Preview Environment. Regardless, you have the option of configuring all of the same scalability settings that you configured for your CD.

Conclusion

That's all you have to do! You should now have a fully functional Preview Environment for your Content Authors to use.

1 Comments
Post a Comment

 
  • Comment by John on Sep 21, 2017
    this poost provides good information on creating a preview environment for content authors in sitecore, for sitecore certified partners visit skybridge infotech