Try our conversational search powered by Generative AI!

block divs



I'm using episerver 7.1 with mvc razor. When using and contentareas and blocks I get Extra div Tag around it.

How do I make it go away?

Do I have to implement a own renderer as done in alloy templates or what?




Apr 10, 2013 10:23

The block container nodes are necessary for editing the blocks in on page edit. 

ContentAreas renders a two level structure. A container node for the content area and one block container node for each block. Like this:

    <div><!-- rendered content of block 1 --></div>    
    <div><!-- rendered content of block 2 --></div>

And when the ContentArea is rendered in edit mode those block container nodes include the block information (and some more attributes)

<div data-epi-property-name="MainContentArea">
    <div data-epi-block-id="31"><!-- rendered content of block 1 --></div>    
    <div data-epi-block-id="32"><!-- rendered content of block 2 --></div>

If you really need to you can of course implement your own renderer, but then you would have to have different rendering between preview and edit (if you want to enable edit of blocks on the page). I wouldn't recommend it.  




Apr 10, 2013 15:56

Well, I understand the need in edit mode. 

But when on the site in "viewmode" you do no need or want them (in my opinion). Should be configurable at least.

Apr 12, 2013 9:31

The decision has been to make the two modes render the same. One thing we wanted to avoid, is that the partner needs to style two cases. Whether it should be a container node or not is debatable. I don't think it's wrong not want them in view mode. As it is now, it's consistent. When the blocks are rendered, there's no way for us to know how the block will be rendered. It could be only a text node, without any elements. From that point of view, I think it's fine to render container nodes around the blocks. But this could of course change for future releases. We have discussed these options. You're not the only one to ask about it.


May 03, 2013 16:32
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.