ATR
ATR

Reputation: 23

Sitecore preview not working

I am having some troubles with Preview in Sitecore. I'm using version 6.6.

When I click the Preview button from the presentation tab, I see the following grey screen. https://i.sstatic.net/xwkft.jpg

When I click Preview from the Publish tab I get the following error in a popup. https://i.sstatic.net/xZV0I.jpg

Here is my site in Web.config.

<site name="website" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/My Website" startItem="/home" language="en-GB" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />

One thing I thought it could be is that the language is set to en-GB. Could this be part of the problem? All the items in sitecore are set to en-GB and I have updated the ClientLanguage and DefaultLanguage settings in my Web.config to en-GB as well.

Thanks in advance for your help.

EDIT: Found the issue in a config file in my Include folder. I don't know why this is needed so I have deleted it. I don't know why it was breaking my preview either.

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <encodeNameReplacements>
      <replace mode="on" find=" " replaceWith="-"/>
    </encodeNameReplacements>
    <sites>
      <site name="website">
        <patch:attribute name="name">My Website</patch:attribute>
        <patch:attribute name="rootPath">/sitecore/content/My Website</patch:attribute>
        <patch:attribute name="startItem">/Home</patch:attribute>
      </site>
    </sites>
  </sitecore>
</configuration>

Upvotes: 1

Views: 4903

Answers (3)

Vyacheslav Pritykin
Vyacheslav Pritykin

Reputation: 441

There are the following settings in the Web.config:

<!--  PAGE PREVIEW SITE NAME 
      Specifies the name of the site that is used to generate page previews, for example "website".
      If blank, Sitecore uses the value in the Preview.DefaultSite setting.
      Default value: "" (use the value of the Preview.DefaultSite setting)
 -->
<setting name="PagePreview.SiteName" value="" />

and

<!-- Preview.DefaultSite
     Specifies name of the default site for WebEdit preview mode
-->
<setting name="Preview.DefaultSite" value="website"/>

It means that Sitecore always tries to use the site called website for Preview by default. However, your include config file changes the name of the site from website to My Website. That's why Sitecore cannot find the website and threw an exception

Site "website" not found

Upvotes: 1

Shriroop
Shriroop

Reputation: 1182

Try this

<site name="website" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/home" language="en-GB" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />

Basically change rootPath to "/sitecore/content" if your website item is called "home"; if you have named your website item as My Website still change your rootPath to "/sitecore/content" but also update your start item to "/My Website"

Upvotes: 1

user459491
user459491

Reputation:

do you have this item structure on your sitecore solution ?

/sitecore/content/My Website/home

It's strange you have under your rootPath,"Home" item like startItem.

Can you check please?

You also can look to this document.

Upvotes: 0

Related Questions