Take the community feedback survey now.
AI OnAI Off
Take the community feedback survey now.
Hi,
Assuming you want this to apply to all XhtmlString fields, an easy way to do this would be to override the display template used to render XhtmlString fields. You can do that by creating a view called "XhtmlString.cshtml" in Views/Shared/DisplayTemplates and paste in the following:
@using EPiServer.Core
@model XhtmlString
@{
Html.RenderXhtmlString(Model, new VirtualPathArguments { ForceAbsolute = true });
}
Hello
In our solution we have a pages where the rich text field is rendered using "@Html.PropertyFor(m => m.CurrentContent.MyRichTextField)" inside these text fields epi-links are inserted to make it easier for content managers to change.
However during render these epi-links are rendered to relvative urls, but we would like to have the epi-links to be absolute urls.
Is there a way to force CMS to always render epi-links using absoluteUrls? If this is a general setting its prefered.
This can technically be solved by changing the rendering to "@Html.XhtmlString(Model.CurrentContent.MyRichTextField, new VirtualPathArguments { ForceAbsolute = true})", however we have quite a few richTextFields in our solution, and it would be nice to handle rich text fields the same way as when we render other other properties in html.
Ive noticed, that Html.PropertyFor also can take VirtualPathArguments however, when i add argument from above nothing happens and the field is rendered as a relative url.