通过Glass呈现时,Sitecore Rich Text链接对用户不友好 [英] Sitecore Rich Text links not user friendly when rendered through Glass

查看:81
本文介绍了通过Glass呈现时,Sitecore Rich Text链接对用户不友好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含一个RTF文本字段的组件.在子布局中,该字段用Glass呈现为Html.Editable,以便可以在PageEditor中的页面上对其进行编辑.看起来像这样:

I have a component that includes a single Rich Text field. In the sublayout, the field is rendered as an Html.Editable with Glass so that it can be edited on the page in PageEditor. It looks like this:

public override void Initialize()
{
    litBodyContent.Text = Html.Editable(GlassItem, item => item.Body);
}


<div style="min-height: 38px">
    <asp:Literal runat="server" ID="litBodyContent" />
</div>

但是,当我使用Rich Text编辑器插入链接时,呈现页面时(发布后在普通视图中,而不是在页面编辑器中),链接将使用项ID而不是用户友好路径来呈现这个:

However, when I insert links using the Rich Text editor, when the page is rendered (in normal view after being published, not in page editor), the links are rendered with the item ID rather than the user friendly path, like this:

<a href="~/link.aspx?_id=D9D103AD60DA4B318521801ADA863222&amp;_z=z">Go to another page</a>

我很确定这是Glass的问题.如何在页面编辑器"中保持字段可编辑,但使其正确呈现链接?

I am pretty sure that this is an issue with Glass. How can I keep the field editable in the Page Editor but make it render the link correctly?

推荐答案

您可以检查模型中是否具有适当的属性.

You can check if you have proper attribute in the model.

如果您具有 SitecoreFieldSettings.RichTextRaw 属性,它将通过渲染管道并返回RAW HTML.相反,如果您使用默认( SitecoreFieldSettings.Default ),则富文本内容将通过渲染管道,而url将采用友好格式.

If you have SitecoreFieldSettings.RichTextRaw attribute, it will NOT pass through render pipeline and returns the RAW HTML. Instead if you use Default (SitecoreFieldSettings.Default), rich text content will go through render pipeline and url will be in friendly format.

http://docs.glass.lu/html/d44739b2-5f0e-d862-f62c-86c50f0b262f.htm

这篇关于通过Glass呈现时,Sitecore Rich Text链接对用户不友好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆