November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Seems like you are getting or using internal links, typically you should check your code so that the contextMode isn't contextMode.Edit
Care to post a bit of code showing how you output these links in your templates?
This is our "GetUrlLink" method:
public string GetUrlLink()
{
if (PhoneNumber.IsNotNullAndNotWhiteSpace())
{
return $"tel:{PhoneNumber}";
}
else if (UrlLink != null)
{
if (UrlLink.Scheme.Equals("mailto", StringComparison.OrdinalIgnoreCase))
{
return UrlLink.OriginalString;
}
else
{
var urlResolver = ServiceLocator.Current.GetInstance<UrlResolver>();
var pageRouteHelper = ServiceLocator.Current.GetInstance<IPageRouteHelper>();
var currentPageUrl = urlResolver.GetUrl(pageRouteHelper.Page.ContentLink);
if (currentPageUrl == urlResolver.GetUrl(UrlLink.Path) && UrlLink.Fragment.IsNotNullAndNotWhiteSpace() && UrlLink.Fragment.StartsWith("#"))
{
return UrlLink.Fragment;
}
return urlResolver.GetUrl(UrlLink.OriginalString);
}
}
return string.Empty;
}
I'm thinking the problem is on the 2nd to last return statement:
return urlResolver.GetUrl(UrlLink.OriginalString);
Hi, I'm not to sure about that. The urllink should most likely look something like this /link/61104228962d4dd2925cb5b12e2373ee.aspx.
I'm sticking with my original guess that you have some issues with your ContextMode. Possibly that you use this method PageEditing.GetEditUrl to resolve the contentLink url. How do you feed the UrlLink property?
This is my UrlLink property:
[CultureSpecific]
[Display(
Name = "Link Url",
GroupName = SystemTabNames.Content,
Order = 100)]
public virtual EPiServer.Url UrlLink { get; set; }
Tried your code, added a property just like yours and it works just fine.
Check your contextmode by running
var contextModeResolver = ServiceLocator.Current.GetInstance<EPiServer.Web.IContextModeResolver>();
// the context mode is available in
var contextMode = contextModeResolver.CurrentMode;
Typically you want ContextMode.Default
We are on CMS 12. We upgraded all our NuGet packages to the very latest version and after doing this, when we open a page by using the View on website link in the CMS, all the links on the page are generated like this:
https://my-domain.dxcloud.episerver.net/EPiServer/CMS/Content/en-us/fleet-leasing,,2705?epieditmode=true
instead of like this:
https://my-domain.dxcloud.episerver.net/en-us/fleet-leasing
If I open the site in an incognito window where I'm not logged into the CMS, this does not happen. This only happens if I open a page in the same browser window where I'm also logged into to the CMS.
Is this expected behavior with the latest version of CMS 12? Is there a setting that controls this?