本文介绍了Sitecore MVC确保在体验编辑器中可以选择空的占位符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Sitecore MVC中的占位符是否有一些技巧,以确保即使它们不包含任何渲染,也总是可以在体验编辑器中选择它们?我的控制器渲染在cshtml视图中声明了占位符,如下所示:
Is there some trick with placeholders in Sitecore MVC to ensure that they are always selectable in the experience editor even when they don't contain any renderings? My controller rendering declares the placeholder in the cshtml view as follows:
<div>
<!-- some html markup and fields rendered here -->
@Html.Sitecore().Placeholder("my-component-placeholder")
</div>
推荐答案
为确保占位符的可见性和选择性,您需要确保以下内容:
To ensure placeholder visibility and selectability, you need to ensure the following:
- Sitecore中存在一个占位符设置项,它与cshtml呈现中声明的正确
Placeholder Key
匹配. - 占位符设置项已选中
Editable
设置. - 页面中的CSS不会阻止占位符可见.
- A placeholder settings item exists in Sitecore with the correct
Placeholder Key
matching that declared in the cshtml rendering. - The placeholder settings item has the
Editable
setting checked. - The CSS in the page is not preventing the placeholder from being visible.
这篇关于Sitecore MVC确保在体验编辑器中可以选择空的占位符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!