I have a site in sitecore at domain1.com
<site rootPath="/sitecore/content" startItem="/home" .. />
I want to create a second site at domain2.com that uses same items
<site rootPath="/sitecore/content" startItem="/home" ... />
Both sites refer to same items in content tree. Clear?
The links generated by sc:path(.) (makes absolute links) on the domain2.com refer to domain1.com.
As far as I understand links refer to the first site in web.config that refered to the items in content tree.
How can I get valid links for both sites?
Just Rendering.SiteResolving to false.
The the sitecore will determine the urls' hostname from http request.
Related
I have an issue with mapping SitecoreInfoType.Url on a sitecore multisite solution.
I have in sitecore 2 websites:
Site A
Site B
Site A contains some articles:
www.Site-A/Articles/Article 1
www.Site-A/Articles/Article 2
On our main "Article landing page", we have a widget that shows a short description of each article with links to article page.
for using the url, we are mapping it with SitecoreInfoType.Url
e.g.
[SitecoreInfo(SitecoreInfoType.Url)]
public virtual string Url { get; set; }
This is rendered correctly as it is used on Site A, we get dynamic urls like /en/Articles/{Article Name}.
If we try to use the widget on Site B, the url is not generated as expected:
/en/sitecore/content/Site A/Home/Articles/{Article Name}
We already have implemented on website Sitecore fields of Link type and we are using UrlOptions for solving this kind of behaviour.
e.g.
[SitecoreField(UrlOptions = SitecoreInfoUrlOptions.SiteResolving)]
public virtual Link AlternateLink { get; set; }
This will generate the expected result. If we are trying to generate a Link for a target item that is under other website, domain will be used for generating url.
Target item is under Site A.
Widget is used on Site B and context is set to Site B
Link Url is generated like: www.Site-A/Articles/{Target item}
Unfortunately glass mapper is not mapping in the same way SitecoreField and SitecoreInfoType.Url.
Update on code:
[SitecoreInfo(SitecoreInfoType.Url, UrlOptions = SitecoreInfoUrlOptions.SiteResolving)]
public virtual string Url { get; set; }
And in similar context:
Target item is under Site A.
Widget is used on Site B and context is set to Site B
Link Url is generated like: /en/sitecore/content/Site A/Home/Articles/{Target item}
Note:
Other UrlOptions used on SitecoreInfoType.Url are working:
SitecoreInfoUrlOptions.AddAspxExtension
SitecoreInfoUrlOptions.AlwaysIncludeServerUrl
SitecoreInfoUrlOptions.LanguageEmbeddingNever
In case of using SitecoreInfoUrlOptions.AlwaysIncludeServerUrl the result is strange: www.Site B/en/sitecore/content/Site A/Home/Articles/{Target item}
For me it seems that this is a bug in glass mapper library.
Anyone had this issue and a fix or workaround?
I would prefer to not use Sitecore API and try to get the item and use LinkManager again as this is already used in glass mapper implementation.
Here is my site definition config:
<sites>
<site name="siteA"
patch:before="site[#name='website']"
hostName="siteA.domain.com"
targetHostName="siteA.domain.com"
virtualFolder="/"
physicalFolder="/"
rootPath="/sitecore/content/domain/siteA"
startItem="/Home"
database="web"
domain="extranet"
allowDebug="true"
cacheHtml="true"
htmlCacheSize="50MB"
enablePreview="true"
enableWebEdit="true"
enableDebugger="true"
disableClientData="false"
scheme="http"
/>
<site name="siteB"
patch:before="site[#name='website']"
hostName="siteB.domain.com"
targetHostName="siteB.domain.com"
virtualFolder="/"
physicalFolder="/"
rootPath="/sitecore/content/domain/siteB"
startItem="/Home"
database="web"
domain="extranet"
allowDebug="true"
cacheHtml="true"
htmlCacheSize="50MB"
enablePreview="true"
enableWebEdit="true"
enableDebugger="true"
disableClientData="false"
scheme="http"
/>
</sites>
I have built a sitecore site in my dev PC and published it. (From master to web database).
How can I browse the site as an anonymous user.
Say, if i browse the url mysite/pages/about, it loads the page but within the sitecore shell. (and also, I need to be logged in)
I would like to see it, as if it went live. Is this possible.
Since you are still logged into Sitecore by default it will use those credentials to load the page in "Edit Mode".
Use a different browser or open a tab in incognito/private browsing mode.
Alternatively, in Experience Explorer from the Home Ribbon section select "Close" or append ?sc_mode=normal to the URL of the page.
There is a cookie named website#sc_mode which will also be set to Edit when you are in Experience Editor, which remembers your last selection. You could also try removing this as well as the other Sitecore cookies.
There has to be a SiteDefinion.config file in the App_Config/Include folder, which is not avilable by default.
Lets say, the sitecore instance name is democore and you have to develop a website - mysite.
And your content tree may be structured as :
Sitecore > Content > MySite > (home, about, contact etc)
This config file will have the following configuration
<configuration xmlns:patch="www.sitecore.net/.../">
<sitecore>
<sites>
<site patch:before="*[#name='website']"
name="/"
hostname="democore"
virtualfolder="/"
physicalfolder="/"
rootpath="/sitecore/content/"
mediapath="/sitecore/media library/mysite/"
startitem="/home"
loginpage="/login"
database="web"
domain="extranet"
allowdebug="false"
cachehtml="false"
htmlcachesize="10MB"
registrycachesize="0"
viewstatecachesize="0"
xslcachesize="5MB"
filtereditemscachesize="2MB"
enablepreview="true"
enablewebedit="true"
enabledebugger="false"
disableclientdata="false"
language="en"
usedisplayname="true"
embedlanguage="false"
embedlanguageinmedia="true"
routesitename="mysite" />
</sites>
</sitecore>
</configuration>
You can now browse the site as democore/mysite/home
I'm using Sitecore 7.2 DMS (Digital Marketing System) to personalize content based on pattern cards. The problem I'm having is that the engagement analytics tool is not recording any data.
I already troubleshooted the problem based on this post but I haven't had any luck. Summarizing I checked:
Sitecore.Analytics.config is in the Include folder
The Analytics DB connection string is correct
Analytics.DisableDatabase is false
I even add the enableAnalytics in the web.config (true by default)
<site name="website" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" startItem="/home" 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" enableAnalytics="true" />
Thanks in advance
Apart from configuration, your pages should have a VisitorIdentification tag, so that Sitecore will be able to collect tracking information. Please make sure you have got a correct tracking tag being set up on your custom page layouts.Below are examples for WebForms and MVC versions of Sitecore(correspondingly).
WebForms:
<sc:VisitorIdentification runat="server" />
MVC:
#Html.Sitecore().VisitorIdentification()
See previous SO question on that:
Sitecore Analytics
Disable Bots detection in the Sitecore Analytics config file. by default its true. Make it to false.
I have a multisite configuration, and one of the sites is a secure extranet
Not logged users (anonymous) will be redirected to the login page
the default page is home
So my configuration reads like this
<site name="aodextranet" hostName="preprod.aodextranet.org" virtualFolder="/"
physicalFolder="/" rootPath="/sitecore/content/Sites/Extranet"
startItem="/Home" 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" loginPage="/login.aspx" />
if I go to mysite/home I'm redirected to the login page as expected
but if I only write mysite without the explicit reference to the home
page the sites throws an error: no layout page.
If /home is the start item in the configuration file, I should go to home and then redirected to the login page. I've tried upper and lower case without success
This is a screen cast
http://screencast.com/t/aiF0BNk4lWr
Any help would be really appreciated
The sitecore item /sitecore/content/Sites/Extranet/Home is the item that is shown when you navigate in the browser to preprod.aodextranet.org.
This item should have a layout and sublayouts/renderings added to the presentation tab.
Looking at your configuration it seems that you have misconfigured your site-definition or did not add the presentation elements to the item /extranet/home.
Found it!
After creating a new site in a multisite configuration, you have to publish the whole site... I was publishing only the site node plus the templates. After running the full publish, the site is behaving as expected.
I want to disable the html cache for 1 item so it is always rendered.
Background:
I need to show information for companies stored in a separate database. In sitecore I have 1 item which has the user control that shows the required information and depending on a Context parameter I figure out which company to show.
The sitecore tree look like this:
/sitecore
/content
/home
/company-information
The url is: /show-company-information/[company-name]-[company-id]. I have a pipeline module that parses the url and sets the company information as the current item and adds the company id to HttpContext.Current.Items. That's how my user control figures out which company information to render.
It all works fine in development but once you deploy it to a Content Delivery server it stops working correctly. The first time the page is accessed it gets cached and every consecutive request returns the company information that was cached the first time.
My current workaround is to clear the HTML cache for the company-info item in the same pipeline step that parses the company-information but it seems a really dirty solution.
Is there a better way to achieve the same result?
EDIT
Here is how the site is setup in web.config and also the web database configuration:
<site name="website" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content/Home/" startItem="/home" language="en-GB" database="web" domain="extranet" loginPage="/user-login.aspx" allowDebug="true" cacheHtml="true" htmlCacheSize="400MB" registryCacheSize="500KB" viewStateCacheSize="500KB" xslCacheSize="20MB" filteredItemsCacheSize="20MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
<!-- CACHE SIZES -->
<cacheSizes>
<sites>
<website>
<html>500MB</html>
<registry>500KB</registry>
<viewState>500KB</viewState>
<xsl>200MB</xsl>
</website>
</sites>
</cacheSizes>
<database id="web" singleInstance="true" type="Sitecore.Data.Database, Sitecore.Kernel">
<param desc="name">$(id)</param>
<icon>Network/16x16/earth.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/Web.config" />
</prefetch>
</dataProvider>
</dataProviders>
<indexes hint="list:AddIndex">
<index path="indexes/index[#id='articleIndex']" />
</indexes>
<proxiesEnabled>false</proxiesEnabled>
<proxyDataProvider ref="proxyDataProviders/main" param1="$(id)" />
<archives hint="raw:AddArchive">
<archive name="archive" />
<archive name="recyclebin" />
</archives>
<Engines.HistoryEngine.Storage>
<obj type="Sitecore.Data.$(database).$(database)HistoryStorage, Sitecore.Kernel">
<param connectionStringName="$(id)" />
<EntryLifeTime>30.00:00:00</EntryLifeTime>
</obj>
</Engines.HistoryEngine.Storage>
<cacheSizes hint="setting">
<data>400MB</data>
<items>400MB</items>
<paths>10MB</paths>
<standardValues>1MB</standardValues>
</cacheSizes>
</database>
</databases>
Page layouts structure:
layout - no output caching
- sublayout - no caching options ticked
- offending sublayout - no caching options ticked
Are we doing anything wrong for this to be cached so aggressively?
You can use the CacheManager to turn off caching during the Page Load event then turn it back on in PreRender. This will ensure that the page's html / xslt controls are not cached.
The CacheManager Class has the following method used by all controls when retrieving HTML caches
/// <summary>
/// Gets the HTML cache.
/// </summary>
/// <param name="site">The site.</param>
/// <returns>The HTML cache.</returns>
public static HtmlCache GetHtmlCache(SiteContext site)
{
if (_enabled && (site != null))
{
return site.Caches.HtmlCache;
}
return null;
}
So setting the Enabled Property to false will stop the controls being rendered from the cache:
CacheManager.Enabled = false;
Its brutal but it works.
If your HTML is being cached, its from a specific rendering, e.g. a specific sublayout. If you have a sublayout set to cache and vary by anything in Layout Details, undo that. Or, you may be doing it in code, in which case you can change your C# to not cache it.
Here's a sublayout in code that is set to cache, you may have something like this that you'd want to not cache:
<sc:Sublayout Path="~/layouts/sublayouts/mycontrol.ascx" Cacheable="true" runat="server" />
If this cache problem is cleared by just publishing any sitecore item, then its safe to assume its the sitecore HTML cache.
Any layout or sublayout with caching enabled will also cache the output any control added within it. So if any parent sublayout of this control or rendering has caching enabled you'll need to disable it.
An easy way to view the cache settings for your page is via the debugger [Start] > [Debug]
Hovering over the controls will allow you to view their resultant cache settings.
If your item is a sublayout, you can disable its rendering cache in the page editor component properties or through the definition of the sublayout item in the Cache section.
For example, I have a search results sublayout with cache disabled.