In this post, I will sharing my recent experience of customizing SharePoint 2016 suite bar branding. As we know SharePoint out of box suite bar looks like below with following elements.
Following tasks can be accomplished on the SharePoint suite bar.
1. We can replace the default SharePoint text with either your company name or company logo. This can be done by accessing SharePoint CSS class ''o365cs-nav-leftAlign" and "o365cs-nav-brandingText" using Jquery.
2. In the center section of the suite bar, we can add text or icon using css class "o365cs-nav-centerAlign".
3. In the right section, I will adding suite bar links using SharePoint css class 'o365cs-nav-rightAlign'.
This post will majorly discuss branding the left and right sections of the SharePoint 2016 suite bar.
The final output will be as follows:
1. On the left side of the suite bar, I will be placing logo using SharePoint Jquery/REST.
2. On the right side of the suite bar, I will be placing suite bar links and when clicked on these suite bar links, I will be displaying additional sub menu links.
Development:
I had created entire solution as farm solution and once I have the wsp I had used the wsp in SharePoint HTML master page so that I can see the suite bar branding elements in every page of my custom master page.
Below is the final structure of my the project:
In the visual studio project, I had created visual webpart, The only purpose of the visual webpart is that it holds all the javascript and css customization. Here is the code for visual webpart designer page.
SuiteBarCustom.js: this file will be generating all the HTML elements for right and left section of the suite bar for adding the logo and adding suite links. Below is the code.
SuiteBarCustom.css
Source: I had used SharePoint list to retrieve the links for suite links in SharePoint suite bar.
Deployment: Build the solution and use the wsp generated from the solution to add it onto custom master page. Below snippet is generated from design manager and used in master page.
The above post showed how I had developed and deployed custom suite bar links.
Following tasks can be accomplished on the SharePoint suite bar.
1. We can replace the default SharePoint text with either your company name or company logo. This can be done by accessing SharePoint CSS class ''o365cs-nav-leftAlign" and "o365cs-nav-brandingText" using Jquery.
2. In the center section of the suite bar, we can add text or icon using css class "o365cs-nav-centerAlign".
3. In the right section, I will adding suite bar links using SharePoint css class 'o365cs-nav-rightAlign'.
This post will majorly discuss branding the left and right sections of the SharePoint 2016 suite bar.
The final output will be as follows:
1. On the left side of the suite bar, I will be placing logo using SharePoint Jquery/REST.
2. On the right side of the suite bar, I will be placing suite bar links and when clicked on these suite bar links, I will be displaying additional sub menu links.
Development:
I had created entire solution as farm solution and once I have the wsp I had used the wsp in SharePoint HTML master page so that I can see the suite bar branding elements in every page of my custom master page.
Below is the final structure of my the project:
SuiteBarCustom.js: this file will be generating all the HTML elements for right and left section of the suite bar for adding the logo and adding suite links. Below is the code.
Source: I had used SharePoint list to retrieve the links for suite links in SharePoint suite bar.
Deployment: Build the solution and use the wsp generated from the solution to add it onto custom master page. Below snippet is generated from design manager and used in master page.
The above post showed how I had developed and deployed custom suite bar links.
So you have a custom webpart inside a master page to customize suite bar? I am also trying to customize suite bar but nothing is working.
ReplyDeleteCan you post the actual code for this please? Would be perfect for my SP2016 site.
ReplyDelete