We configured CM/CD environment for a website. When using Web Forms for Marketers in a CD environment, We faced an issue on custom save action, It was not working, it did not log any error in sitecore logs and it goes to next action like redirect and success page.

There is a simple and easy way to resolve this issue, on WFFM custom save actions we need to mark checked on “Client Action” option.

If you are planning to upgrade your Sitecore to latest version, there are a few different ways of doing it. But be careful. Sitecore upgrades aren’t always straightforward.

Sitecore upgrade could introduce many problems if it’s done without planning. Here I will talk about recommendations and best practices to follow-up while doing upgrade

There are two upgrade approaches mentioned below–

Install of 8.X and migration of content

Incremental upgrades as per Sitecore’s documentation

Lets talk about each approach in detail

Install of 8.X and migration of content

o In this approach we can move content (content items and media library) from old Sitecore installation to new fresh Sitecore installation via Sitecore packages. It’s a quick upgrade approach for small websites but it’s not the recommended approach.

o Pros

Quick upgrade process for small websites

o Cons

Not supported by Sitecore

Migrating content to a new solution can be a bit risky since the moved items are not updated and new versions of the UpdateInstallationWizard performs some post installation steps which fixes some field values on standard fields

Migrating Sitecore users to new solution reset their password. Admin has to resent password to all the users

Migrating content to new solution does not work well for larger projects, it’s become time consuming as compare with installing the upgrade packages

Incremental upgrade

If you are upgrading from 6.6 to 8.1, for example, this approach requires a series of intermediate steps of installing packages, updating configuration files and running update scripts on the databases

o Pros

Supported by Sitecore

No need to worry about package installation and user migration

Give opportunity to migrate analytics database

Opportunity to upgrade Sitecore modules like WFFM and ECM without losing data

o Cons

With this approach we have to run upgrade two time first during development and second before prod release with content freeze

QA will do smoke testing of website and record and error found. Common error after upgrading from version to 6 to 7 is

The major API change between 6 and 7 is Sitecore.Search. This can be a big task depending on project size and lucene usage

If there are some modules installed which are not supported by Sitecore then update their code to support new API

If there any customization in Sitecore using OLD API that may not work in new version

Bug fixing

Fix the issues raised by QA

Alpha Testing

QA will run one more round of testing and validate issues raised during internal testing

Beta Testing

Setup UAT environment so that client can validate website

Preparation for Prod release

This is content freeze and code freeze step. From the start of this step till prod release client’s content team is not allow to make any update on content tree

Take latest database backups from production server and restore it on local development machine

Run upgrade again from initial Sitecore version

To save some time and avoid any human error we can do below

Install the Sitecore recommended upgrade packages and run the sql scripts.

For config updates don’t do it again instead copy all the configs from back that was created during initial upgrade for specific Sitecore version. Manually updating config files consumes lots of time and increase chances of error because of human mistake.

Merge any code update to UAT (if client IT team is doing it)

i. Make sure client IT team is not doing any major code update using initial version Sitecore API

Adding Canonical URL for Sitecore Item

SEO (Search Engine Optimization) best practice suggest you to use a single URL for a particular resource. Content with duplicate URLs are given lower rankings by crawlers and instead of using multiple canonical URLs and redirecting to it’s item URL to show in address bar for a particular resource, we should use search engine’s recommended canonical tag. This tag will be added in html head tag. It’s a link tag with rel=”canonical”. This rel property is used as a hint for crawlers to consider the actual URL of the resource and should be used in their indices for ranking purpose. Take a look at sample canonical tag.

<link rel=”canonical” href=”https://example.com/resource” />

How to add a canonical tag for sitecore Item?

To add a canonical tag for your sitecore item, use following code in your page load function in your layout file. This function will call GetCanonicalUrl() function to retrieve canonical URL for the current requested Item. The following code lines will create a tag with rel=”canonical” and add it into html head tag. Remember the head tag should be runat=”server” to access it in code behind.

I have recently started working with Sitecore MVC using glass mapper. In my project I have several view renderings where I need to access the details of datasource item and as well as current context item. I knew that GlassView class takes the type of model as generic type argument and then if there is data source mentioned for the view rendering then it creates the model from data source item otherwise it creates the model from current context item.

Here my requirement was to use both (model as my data source and current context item) as strongly typed objects in my view renderings. Hence I started to look into the GlassView class and found some interesting public methods and properties that are useful to developers:

Properties:

S.No.

Name

Purpose

1.

ContextItem

Returns the item specified by the current context item.

2.

DataSourceItem

Returns the item specificed by the data source only. Returns null if no datasource set.

3.

LayoutItem

Returns either the item specified by the DataSource or the current context item.

Methods:

S.No.

Name

Purpose

1.

GetContextItem

Returns the Context Item as strongly typed.

2.

GetDataSourceItem

Returns the Data Source Item as strongly typed.

3.

GetLayoutItem

Returns the Layout Item as strongly typed.

4.

GetRenderingParameters

Returns the parameters as strongly typed.

As there is out of box support available for strongly types in GlassView for data source and as well as context item so we started with defining a variable in our view renderings as below:

@inherits GlassView<MyDataSource>@{

var pageItem = GetContextItem<MyContentItem>();

}

<div>@pageIem.Title</div>

But this was tedious to verify that developers in my team were using this strongly typed approach instead of using the context item directly so I created small abstract class by inheriting from GlassView:

There is now a separate publishing log in Sitecore 7.2. Any operations happening as part of the publishing pipeline will now log to this file. This includes AUDIT entries. Mainly for backwards compatibility reasons, the main log.txt will still show main publishing related entries.

ChallengeExtend the Sitecore dedicated publishing log to show main publishing entries so that it’s easy for website admin to review publishing actives

SolutionWe can can use Sitecore’s “Sitecore.Publishing.Diagnostics.PublishingLog” to write any custom information into publishing log file. In our case we have followed below steps to achieve it -

Create a class with the name let’s say “PublishLogExtensions.cs” and inherit it from PublishItemProcessor

Once above setting is updated open Sitecore content tree. You can add google events to anchors using two fields type in Sitecore

Rich Text Editor

General Link

To insert google event using Rich Text Editor follow below steps –

Select any item which Contains RTE field.

Select show editor option highlighted in above image. In RTE type any text like “Google Event”. Select this text and insert link on this text by selecting Hyperlink Manger from the tools of RTE.

Select Analytics Events tab in Hyperlink Manager Popup and enter events details in the form as shown in below image

Click ok when you are done

Accept the changes in RTE and save the Sitecore item. This event will look like below in html of page. You can see this in Sitecore as well by clicking on HTML tab of RTE<a onclick=”_gaq.push(['_trackEvent','Category','Action','Label',1]);”>goolge event</a>

To insert google event using General Link Field Type follow below steps –

Select any item which Contains General Link field.

Inset link detail by selecting Insert option Link

To crate google event click on Google Event option highlighted in above image. It will open a popup with the form. Fill the form with proper argument for google event

Click ok when you are done

Save the Sitecore item. This event will look like below in html of page. You can see this in Sitecore as well by selecting raw value checkboxonclick=”_gaq.push(['_trackEvent','Category','Action','Label',Value]);”

Note – This package is based on assumption that webpages are already rending google event tracking js provided by google.

Sitecore Package is available on Sitecore market marketplace Click here to download

Purpose of this article is to explain new developers how to properly used dictionary domain. Good technical explanation of dictionary domain can be found here

Sitecore 6.6 introduces the concept of dictionary domains. In any database, you can create any number of dictionary domains, which are items based on the System/Dictionary/Dictionary Domain data template. On each dictionary domain you can specify the fallback domain. If certain key is not found in site specific dictionary domain then program will search key in fallback domain.

Follow below steps to use dictionary domain in your Sitecore website:

Based on your Sitecore content tree structure create item of template “/configuration/sitecore/sites/site”. We normally use below structure in our project where we organize different sites in different folders in case of multi-site environment (you can use same structure for single website as well) and each site contains 2 node under it. One is used to store global setting (Used to store all global meta data used on different pages of website like header, footer) of this website and other is home item under which all pages of website get storeSitecoreContentSite One NodeGlobal Settings SampleDictionary DomainHome

Under dictionary domain folder you can add dictionary entries. You can create folder as well under dictionary domain to organize dictionary entries in logical structure. You can also nest dictionary domains

Once dictionary domain structure is created in Sitecore content tree next step is to use dictionary in layout or sublayouts. There are two ways to use Sitecore dictionary

i.Define Dictionary domain in Sites setting in web.config. a. With this approach open web.config file and add dictionary domain attridute (dictionaryDomain=”Sample Dictionary Domain”) to your managed sites (/configuration/sitecore/sites/site) b. dictionaryDomain attribute in web.config could be name of dictionary domain or GUID of dictionary domain c. Use below code to get dictionary phrase using key in codeSitecore.Globalization.Translate.Text(“key”);

ii. You can also define dictionary domain in code as shown belowSitecore.Globalization.Translate.TextByDomain(“Domian”,”Key”);

As with any other pipeline, you can add processors to, remove processors from, and override processors in the getTranslation pipeline. For example, when porting an existing ASP.NET site into Sitecore, you could add a processor that looks for entries in the resource files from the old site if no entry for a key exists in the Sitecore dictionary system.

If you are using SiteDefinition.config to manage multiple sites then make sure SitecoreCDN.config execute after SiteDefinition.config file. One thing you can do is update name of SitecoreCDN.config by adding prefix “Z” like ZSitecoreCDN.config

CDN Sitecore connector package for Sitecore 7.2 can be downloaded from here

Conclusion – Existing CDN Sitecore connector contains reference of old DLLs and .net framework. By updating reference it will start working with latest Sitecore version