Many developers are facing an issue while trying to add the application shortcut to the start menu in Sitecore 7+ & Sitecore 6.6.
This is because Sitecore no more allows the url attribute in General Link field’s raw value in Sitecore 7+(see Brijesh Patel’s blog about this).
The same is true for Sitecore 6.6 as it is adding .aspx extension to the url.
We can solve the issue in Sitecore 7+ by adding the url attribute to the raw values of Link field as suggested by Nilesh Thakkar & Marks ,to resolve this issue in 6.6 you can have a look at Jeremy’s post.
All the solutions by these guys will resolve the issue,but still we need to update the raw value each time we update the link field.
So I decide to automate the process to add the url attribute(in Sitecore 7+) back to the Link field’s raw value (Not sure about the other impact it will cause to the Sitecore & for that we have raised Sitecore support case & and will update the blog once done!)
Here are the steps to do it:
First of all locate the “MakeInternalLinkFromTreeView.js” ,under “/sitecore/shell/client/Speak/Layouts/Renderings/Resources/Rules/ConditionsAndActions/Actions”
This file contain the markup for Link field’s raw value in a variable called template,this is how it looks:
template = ‘<link text=”<%=displayText%>” linktype=”internal” class=”<%=styleClass%>” title=”<%=alternateText%>” <%=target%> querystring=”<%=queryString%>” id=”<%=itemId%>” />’
if you have notice,we do not have any url attribute in this markup,so lets add it like this:
template = ‘<link text=”<%=displayText%>” linktype=”internal” class=”<%=styleClass%>” title=”<%=alternateText%>” <%=target%> querystring=”<%=queryString%>” id=”<%=itemId%>” url=<%=urlValue%> />’
After adding the new url attribute,who gets the value from <%=urlValue%>,let’s define a new variable called urlValue & assign the value to this.
I decided to keep my variable deceleration separate from other variables,so defined it at the top as:
As we would need the url of the currently selected item ,we can get that from other variable named “path”,which contain the full path of the selected item.
We will need to tweak the value as per our need:
urlValue: ‘\”‘ + path.replace(“/sitecore/content/”, “/”) + ‘\”‘
Here we assigned value in our variable from path variable & removed the sitecore/content from that path.
Finally save all the work we have done so far & go to Sitecore & switch to core db than assign item to your application shortcut.
You will see the url attribute in raw value of the Link field & also refresh the Sitecore & your app shortcut should appear in Start menu as well.