0

I have created a custom master page, now I want to create a custom page layout associated with this master page with no left navigation. Any ideas? I have tried a few online solutions but not working.

Here is the code

<!--MS:<asp:ContentPlaceHolder ID="PlaceHolderMain" runat="server">-->
        <div xmlns="">
            <!--CS: Start Page Field: Title Snippet-->
            <!--SPM:<%@Register Tagprefix="PageFieldTextField" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
            <!--SPM:<%@Register Tagprefix="Publishing" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
            <!--MS:<Publishing:EditModePanel runat="server" CssClass="edit-mode-panel">-->
                <!--MS:<PageFieldTextField:TextField FieldName="fa564e0f-0c70-4ab9-b863-0177e6ddd247" runat="server">-->
                <!--ME:</PageFieldTextField:TextField>-->
            <!--ME:</Publishing:EditModePanel>-->
            <!--CE: End Page Field: Title Snippet-->
        </div>
        <div xmlns="">
            <!--CS: Start Page Field: Page Content Snippet-->
            <!--SPM:<%@Register Tagprefix="PageFieldRichHtmlField" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
            <!--MS:<PageFieldRichHtmlField:RichHtmlField FieldName="f55c4d88-1f2e-4ad9-aaa8-819af4ee7ee8" runat="server">-->
                <!--PS: Start of READ-ONLY PREVIEW (do not modify)--><div id="ctl02_label" style="display:none">Page Content</div><div id="ctl02__ControlWrapper_RichHtmlField" class="ms-rtestate-field" style="display:inline" aria-labelledby="ctl02_label"><div align="left" class="ms-formfieldcontainer"><div class="ms-formfieldlabelcontainer" nowrap="nowrap"><span class="ms-formfieldlabel" nowrap="nowrap">Page Content</span></div><div class="ms-formfieldvaluecontainer"><div class="ms-rtestate-field">Page Content field value. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div></div></div></div><!--PE: End of READ-ONLY PREVIEW-->
            <!--ME:</PageFieldRichHtmlField:RichHtmlField>-->
            <!--CE: End Page Field: Page Content Snippet-->
        </div>
    <!--ME:</asp:ContentPlaceHolder>-->

I fixed it using the following

#sidebar-nav {
                Display:none !important;
            }
            #main-content{
                Margin-left:0px !important;
            }
4
  • What's the Sharepoint Edition 2010 /2013 / online? Jul 21, 2016 at 16:52
  • its SharePoint 2013.
    – bajwa
    Jul 21, 2016 at 19:50
  • I have updated the fix. the ids I am using here to display and use the full page width are actually in my master page and not in Page Layout. It was a hit and trial fix but working perfectly for me now. Thanks man for your time and effort. Really appreciate it. @M.Qassas
    – bajwa
    Jul 21, 2016 at 21:55
  • I updated my answer with your final code to be useful for all @bajwa Jul 21, 2016 at 22:14

1 Answer 1

1

Try to add this CSS code to your Page Layout

    <Style> 
body #s4-leftpanel 
{ 
display: none; 
} 
.s4-ca 
{ 
margin-left: 0px; 
} 
</style>

For 2013 try this

.ms-core-sideNavBox-removeLeftMargin { display: none } /* hide only quick links */
#contentBox { margin-left: 0px } /* make content take full page width */

After more investigation with Bajwa and based on his case he reached to final code and hope it helps all

#sidebar-nav {
    display:none !important;
}
#main-content{
    margin-left:0 !important;
}
10
  • I am also here if you need more clarification Jul 21, 2016 at 16:56
  • ' .ms-core-sideNavBox-removeLeftMargin { display: none }' this works but not the content box thing so I am unable to use the page width. @M.Qassas
    – bajwa
    Jul 21, 2016 at 19:23
  • what's the id of content placeholder in your page layout Jul 21, 2016 at 19:26
  • <div xmlns=""> <!--CS: Start Page Field: Page Content Snippet--> <!--SPM:<%@Register Tagprefix="PageFieldRichHtmlField"
    – bajwa
    Jul 21, 2016 at 19:32
  • Strange div has generated no ID @M.Qassas
    – bajwa
    Jul 21, 2016 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.