Hi,
In the first instance there are a couple of things I'd check.The first would be whether you're caching the page output or any part of the page which would result in the rendered XHtmlString being cached. If so, it could be that your cache is being built from the page when it's being viewed in edit/preview mode. That would result in all users seeing the image URLs as they would be in edit/preview mode rather than the public-facing friendly URLs.
The other would be how you're rendering the XhtmlString property on the page. If you're just outputting the property value to the page directly, for example like this:
@Html.Raw(Model.CurrentContent.MainBody)
the internal URLs in the property value won't be parsed and converted into their equivalent friendly URLs. Using PropertyFor() to render XhtmlStrings should ensure the URLs are correctly processed, for example:
@Html.PropertyFor(x => x.CurrentContent.MainBody)
Hello Paul,
First: We are not using caching on any part of the page.
second: for the display, we are displaying it correctly
@Html.PropertyFor(x => x.CurrentContent.MainBody)
And this is how we add the field on the page
[CultureSpecific]
[Display(GroupName = SystemTabNames.Content, Order = 310)]
public virtual XhtmlString MainBody { get; set; }
Do you have any Save och Publishing event that may alter the value of MainBody that could be the cause of this?
Issue fixed.
the reason behind that behavior was that the Host Name in the Admin - Config section was referring to another environment (Due to database copy).
and after fixing that, the images and videos are loaded correctly and the img src value are correct
Optimizely 12.
We have a page with XhtmlString field, and whenever we try to insert an image, either from the Media files or directly adding it, the Src value does not show correctly after publishing the page
for example, the src value would be something like this:
/EPiServer/CMS/Content/contentassets/1d2dd1505ebe4572b7e7d8d1683b4fb6/image-edit.jpg,,537?epieditmode=false
And the whole xhtmlString value would be:
<p>Direct upload:</p>
<p><img src="/EPiServer/CMS/Content/contentassets/1d2dd1505ebe4572b7e7d8d1683b4fb6/image-edit.jpg,,537?epieditmode=false" alt="Online-seminare" width="1600" height="900" /></p>
And of course, this breaks the images when viewing them live.
Any advice?