我们在Sitecore 8.1 Update 1 MVC中使用GlassMapper 4.0.5.54.问题是,渲染ImageField时,高度和宽度属性都写在img-tag中 - 但仅限于页面编辑器模式.
我们尝试了不同的方法
@Html.Glass().RenderImage(Model, x=> x.ImageField, outputHeightWidth:false, isEditable:true, parameters:new {mw = 1218, mh = 530})
@Html.Glass().Editable(x => x.ImageField, new { mw = 1218, mh = 530, width = (string)null, height = (string)null })
Run Code Online (Sandbox Code Playgroud)
但我们总能得到
<img src="http://url_to_local_website/-/media/image_1218x530.jpg?h=530&la=en&mh=530&mw=1218&w=1216&hash=452505F9D5896956CB6B0F284755555217E62D8A" alt="Alt Text" width="1216" height="530" sc-part-of="field" class="scEnabledChrome">
Run Code Online (Sandbox Code Playgroud)
因此,即使使用显式参数,outputHeightWidth:false它也会在页面编辑器中输出宽度和高度属性并扭曲图像.有什么建议?或者这是一个错误?
在对Glass Mapper ImageParameters的评论中,其他人提到了相同的行为.但是没有答案.
我们将我们的解决方案从Sitecore 8.1 Update 1升级到Update 2.我们的URL是根据显示名称生成的,并且运行正常.
但升级后,行为更改为从项目名称生成URL,尽管ShowConfig.aspx仍显示"useDisplayName ="true"for.
我们使用以下配置:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<linkManager defaultProvider="sitecore">
<providers>
<clear/>
<add name="sitecore">
<patch:attribute name="addAspxExtension">false</patch:attribute>
<patch:attribute name="useDisplayName">true</patch:attribute>
<patch:attribute name="languageEmbedding">never</patch:attribute>
<patch:attribute name="alwaysIncludeServerUrl">true</patch:attribute>
</add>
</providers>
</linkManager>
</sitecore>
Run Code Online (Sandbox Code Playgroud)
现在所有链接只显示404.我错过了什么?
我们尝试了一个空的解决方案,这是相同的行为.所以这是一个Sitecore错误.