Search code examples
xmlbloggerxml-layout

Google Blogger XML Layout Error For Designing Theme


I want to divide the Header area into two parts (No - Logo & No - Ad Area) using Google Blogger XML Layout.

When I trying to save my XML codes the Blogger HTML Editor is showing an error --

The widget with id logo is not within a section (actual parent element is: header.) Every widget should be in a section.

Check My XML codes and also check attached image to understand more What I Want ?

<b:section class='header' id='header' maxwidgets='2' showaddelement='yes'>
<div class='container border-1'>
    <header class='row'>
        <b:widget id='logo' locked='true' title='' type='Header'>
            <div class='col-md-4 col-sm-4 col-xs-1 border-1 d-none d-sm-block'> <div id='logo_main_area_device-lg__md__sm' style='background: #fff; max-height:90px !important; height:90px;'> <div id='logo-text_device-lg__md__sm'><a style='text-decoration:none !important; color:#000 !important;' href='//www.jobluto.com'>JobLuto.Com</a></div> </div> </div>
            <div class='col-md-4 col-sm-4 col-xs-1 border-1 d-block d-sm-none'> <div id='logo_main_area_device-xs' style='background: #fff; max-height:50px !important; height:90px;'> <div id='logo-text_device-xs'><a style='text-decoration:none !important; color:#000 !important;' href='//www.jobluto.com'>JobLuto.Com</a></div> </div> </div>
        </b:widget>
        <b:widget id='ads1' locked='true' title='' type='Header'>
            <div class='col-md-8 col-sm-8 col-xs-11 overflow-none border-1' style='background: #777; padding: 0 0.00000001px 0 0.00000001px;'> <img class='img-fluid' style='width:100% !important; height: 90px !important;' src='http://www.creditlenders.info/wp-content/uploads/banner-ad-banner-ads-macallister-design.jpg' alt=''/> </div>
        </b:widget>
    </header>
</div></b:section>

Watch This Image To Understand My Requirment


Solution

  • In Blogger, b:section tag can only contain widgets represented by b:widget tag. also, to insert your HTML code inside widgets use b:include tag like the following

    <b:widget id='logo'>
      <b:includable id='main' var='this'>
         Your HTML code here
      </b:includable>
    </b:widget>
    

    Your code should be (note class name row within section)

    <div class='container border-1'>
        <b:section class='header row' id='header' maxwidgets='2' showaddelement='yes'>
            <b:widget id='logo' locked='true' title='' type='Header'>
                <b:includable id='main' var='this'>
                    <div class='col-md-4 col-sm-4 col-xs-1 border-1 d-none d-sm-block'> <div id='logo_main_area_device-lg__md__sm' style='background: #fff; max-height:90px !important; height:90px;'> <div id='logo-text_device-lg__md__sm'><a style='text-decoration:none !important; color:#000 !important;' href='//www.jobluto.com'>JobLuto.Com</a></div> </div> </div>
                        <div class='col-md-4 col-sm-4 col-xs-1 border-1 d-block d-sm-none'> <div id='logo_main_area_device-xs' style='background: #fff; max-height:50px !important; height:90px;'> <div id='logo-text_device-xs'><a style='text-decoration:none !important; color:#000 !important;' href='//www.jobluto.com'>JobLuto.Com</a></div> </div> </div>
                </b:includable>
            </b:widget>
            <b:widget id='ads1' locked='true' title='' type='Header'>
              <b:includable id='main' var='this'>
                <div class='col-md-8 col-sm-8 col-xs-11 overflow-none border-1' style='background: #777; padding: 0 0.00000001px 0 0.00000001px;'> <img class='img-fluid' style='width:100% !important; height: 90px !important;' src='http://www.creditlenders.info/wp-content/uploads/banner-ad-banner-ads-macallister-design.jpg' alt=''/> </div>
              </b:includable>
            </b:widget>
        </b:section>
    </div>