Getting rid of Sitecore link prefix (sitecore/content/..)
I have a Sitecore solution with multiple sites. All sites are setup in SiteDefinition.Config, and i can enter all the sites correctly.
My problem is that the internal links on the sites (navigations etc.) pr开发者_如何学Cefixes 'sitecore/content/sitename/' to all my links.
i have tried almost all the fixes/solutions i could think off - but no luck.
Any ideas?
I ran into a similar problem however mine only occurred when the links were between internal sites. I wrote 2 blog posts (post #1, post #2) that detail the solution i used. In short, it involves extending Sitecore's LinkProvider...
Are your site definitions setup to use different values for the rootPath
attribute?
<site name="mysite1" rootPath="/sitecore/content/mysite1" startItem="/home" hostName="mysite1.com" ... />
<site name="mysite2" rootPath="/sitecore/content/mysite2" startItem="/home" hostName="mysite2.com" ... />
Is your
<setting name="Rendering.SiteResolving" value="true" />
set?
if you want to create links the way you want you have to use a LinkManager Config and then get url using the GetDynamicUrl method.
Sitecore.Links.LinkUrlOptions options = new LinkUrlOptions();
options.Site = "Site1";
string portalUrl = LinkManager.GetItemUrl(Item, options);
Hope it helps.
精彩评论