A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
AI OnAI Off
A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
UrlBuilder url = new UrlBuilder(page.LinkURL);
EPiServer.Global.UrlRewriteProvider.ConvertToExternal(url, page.PageLink, System.Text.UTF8Encoding.UTF8);
// url now contains the rewritten URL
Note that the second parameter (page.PageLink) is not necessary, passing null will deduce the PageReference from the url, but if it is known you will gain some perf by passing it.
You should also take a look at the GetHtmlRewriter method on UrlRewriteProvider. This will rewrite an entire HTML chunk with friendly url conversion and rebasing, which may be closer to what you need.
Best Regards, Magnus Stråle