Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Content area generates extra surrounding div

Vote:
 

In order to not render the extra div that is created by Html.PropertyFor, I have implemented the custom content area renderer as per the articel from jon d jones.

However, even though I can see that it goes to the correct part of the renderer, where it should not add extra div, in the end there is an extra div.

else
                        {
                            htmlHelper.RenderContentData(content, true, templateModel, contentRenderer);
                        }

Does anyone have a clue how to not get the extra surrounding div?

#261630
Sep 03, 2021 11:22
Vote:
 

We encountered this on one of our projects recently. I think that these two links may help you:

https://stackoverflow.com/questions/14361347/remove-div-generated-around-shared-block-in-episerver-7

https://www.jondjones.com/learn-episerver-cms/episerver-developers-tutorials/episerver-content-areas/episerver-7-extra-divs-in-content-area-how-to-remove-them/ 

They're both for an older version of Episerver, but I think that the approach is still valid.

#261745
Sep 06, 2021 7:51
Vote:
 

My recommendation would be to keep the divs and have frontend deal with it. Removing them might come back to bite you later on....

#261808
Sep 07, 2021 15:56
Vote:
 

Ok!

Thank you both for your answers. I went with installing the nuget package EPiBootstrapArea which handles the removal of extra divs.

#261809
Sep 07, 2021 16:01
valdis - Sep 09, 2021 9:46
However, that package nowadays has nothing in common with Bootstrap ;)
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.