1

I have a SharePoint Online page created with a template, which I cannot remove the left navigation pane from. (I can edit the list of links, but I want to remove the whole pane completely.)

I've tried to follow tutorials online suggesting I add a Content Editor Webpart and include scripts that will remove the left pane, however I don't have the option to add a Content Editor Webpart on this page. (It doesn't show the ribbon for the page, so only have the "Add A New Webpart" plus sign in the middle of the page to work with.)

I've even copied this webpage to a test site, and changed the site layout to Oslo, rather than Seattle, however the left navigation still shows.

Ideally I would like to remove the left navigation panel from this page only. Not from the entire site.

Thank you for any assistance you can provide.

2

As per my understanding you are using Site Page which is a Modern SharePoint Online Page.

In that case to hide the left navigation you will need to add your custom CSS to that particular page.

In Modern SharePoint you can use SPFx webpart to achieve such requirements.

You can get the Modern Script Editor developed using SPFx which is similar to Script Editor in classic experience using below link:

Modern Script Editor in SharePoint Online.

You can find the official documentation of SPFx on how to setup environment and how to build your SPFx webpart below:

Overview of the SharePoint Framework.

Once you get your Modern Script Editor up and running on your SharePoint Page then you need to add below CSS in your Modern Script Editor to hide left navigation:

<style type="text/css">
    div[class^='spNav_'] {
        display: none !important;
    }
</style>
  • Hi, If this answer helps you then please upvote and accept it as an answer so that it will not be shown in Unanswered questions list. – Ganesh Sanap Oct 26 at 4:49
  • If you want working Modern Script editor package file created using SharePoint Framework then I can provide it to you. – Ganesh Sanap Oct 26 at 4:50
0

I am unclear you are on classic sharepoint site vs modern sharepoint site. In Modern sites, in team sites you always get left navigation. OOB, you can hide left navigation from site settings. In communication sites, by default you don't get the left navigation.

If you are using classic site then your site might have new "site pages" pages library which are modern pages. Here you don't get option of adding web parts like content editor web part. You must write either Extension or a new SPFx webpart and deploy the customization to the site collection.

If you are not using "Site pages" page library then you might be using the classic pages, which should get the content editor web part.

thanks

-Praveen.

  • This is sharepoint online, and on other parts of the site I can get the classic interface (the ribbon menus), just not on this page. The site does use the "Site Pages" page library. I am unfamiliar with writing either an Extension or a SPFx webpart, but am willing to learn. – AnotherUnique Oct 21 at 19:23
  • May I know the relative path of your page? Also, can you try to see the content type of the page? – Rare Solutions Oct 21 at 20:30
  • /sites/yc/offices/relations/SitePages/page-name.aspx – AnotherUnique Oct 21 at 20:41
  • OK. This is using modern site pages which is using SPFX web parts. So, without writing a spfx web part it is not possible as you cannot write js, html or css. You have to create spfx web part and add it just to the pages you want to hide the left nav. It is easy to develop a web part... docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/… – Rare Solutions Oct 22 at 16:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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