How to build a knowledge base in SharePoint

In this post we will describe how to build a great looking knowledge base using SharePoint Online

This post will detail step-by-step how to build a knowledge base using the modern authoring experience in SharePoint Online.

Contents

Intro

SharePoint and knowledge bases have gone hand in hand for many years. If you have been involved with SharePoint for any length of time it is not an uncommon request to be asked to build a knowledge base at some point. With the advent of AI and machine learning within Microsoft 365, plus the introduction of Knowledge & Content Services (formerly Project Cortex), SharePoint Syntex and Microsoft Viva Topics, you may think the need to build a traditional knowledge base has gone the way of the dodo.

Well the pricing of the above services means that my organisation won’t readily adopt these new things, so for now at least continuing to leverage metadata rich lists & libraries will have to suffice! Here’s how I built a knowledge base in SharePoint Online…

IT Knowledge base image

Site features

  • Custom site theme/design
  • Mega-menu navigation
  • PnP modern search V3
  • Custom page templates
  • Site Pages library with additional metadata
  • Lookup value lists
  • Change log list

Web parts used

  • Image with colour block
  • Search box
  • Highlighted content
  • Image/ text
  • Page properties (KB articles)
  • Search results web part
  • Searh filters web part

Approach

I wanted to leverage the modern page authoring experience for creating pages, as there are several people adding content to the knowledge base (KB). So with that in mind the knowledge base is built around the Site Pages library, using the metadata applied to each knowledge base article to drive dynamic web parts throughout the site such as search, page properties and the highlighted content web part.

Within the KB, all KB articles get categorised by the type of technology, application and product they fall under. These work for my KB as I can fit KB articles within these headings. For example:

KB article: How to fix the sync connection in SharePoint 2010

TechnologyApplicationProduct
MicrosoftSharePoint ServerSharePoint 2010

Site Pages library

As mentioned above, the Site Pages library is the lynchpin to the entire knowledge base. Starting with the Pages library, I created columns to capture additional metadata about each KB article. Here are the columns I created:

Technology: lookup column, values held in custom list
Application: lookup column, values held in custom list
Product: lookup column, values held in custom list
Knowledge Type: choice column
Topic: Managed Metadata column
Contact: Person or Group

Technology, Application & Product are what drive each view within the Site Pages library. I have created a view for each Technology and Application, which are used for web parts embedded within the relevant pages (for example: Microsoft).

Product is used as a way to formalise the type of KB articles that are created (for example: Procedure), with Topic effectively being a way to tag KB articles with a wider variety of terms to aid searching and filtering.

Custom site theme/ design

I originally provisioned the site based on the news, resources, actions template in the SharePoint look book. From here I created a simple custom site theme following the excellent blog post how to configure and apply a custom theme in SharePoint Online by Greg Zelfond.

The only thing I did different is I used a different website to generate my theme which you can use here. This theme generator site allows you to access more of the colours that are used when creating a theme to potentially create a multi-coloured theme. For more information of this check out another great post by Laura Kokkarinen here.

Use a theme generator to create a custom theme for your SharePoint Online site.

Homepage

The homepage of the knowledge base is broken down into three key areas: search, recently added and the browse area.

Search: Search web part as part of the PnP modern search solution V3. Connected to a custom search results page (more information below).

Recently added: Highlighted content web part that only shows pages from this site, filtered by recently added earlier this year.

Browse: Three column section consisting of images, text and button web parts. I used the images from the look book template to get the correct sizing for the images above. When updating the images I noticed they didn’t update immediately which I wrote about how to fix here.


The navigation for the KB has been created using the mega menu option within the Change the look > Navigation options. The links have all been created manually for each section, with each link going to either a dedicated page or a view created from the Site Pages library.

Mega menu navigation in the IT KB.

Search web part

The search for the knowledge base is all based on web parts from the PnP modern search solution V3. From the homepage there is a search web part. Before configuring the search web part on the homepage you will need to create and configure the search results page and web part as it is required as a data source. I followed the guidance from the PnP modern search solution documentation to configure the search web part with the following properties:

The search web part configuration on the knowledge base homepage.

Search results

The search results is a dedicated page created within the knowledge base that includes the search box, search results and search filters web parts. The search box web part is configured in exactly the same way as on the homepage and just serves as a consistent way to see your search results and search again if required.

The search results web part has been added to a separate, one-third left section underneath the search box web part shared with the search filters web part. The search results web part has the following settings:

Connect to source: Page environment
Page environment’s properties: Search
Search: Search query
Use a default search query: No
Query template: {searchTerms} Path:{Site.URL} FileType=aspx
Result source identifier: No
Sort order: Created, size
Sortable properties: None
Connect to a search refiners web part: On
Use refiners from this component: Filter
Connect to search verticals: Off
Enable query rules: On
Include personal OneDrive results: Off
Selected properties: {searchTerms} Path:{Site.URL} FileType=aspx
Refinement filters: None
Show paging: On
Number of items per page: 30
Number of pages: 4
Hide navigation: No
Hide navigation if disabled: Yes
Results layout: Simple list

Search filter web part

The search filter web part has been added to the search results page with no additional configuration changes made. Don’t forget (like I did), to get the search filter web part to start to work with your search results, you need to turn it on within the search results web part – under connect to a search refiners web part!


Page templates

I’ve used page templates within the knowledge base to standardise the layout of each KB article. At the time of writing there are only two templates to choose from: an application template or new KB article.

Example KB article page template

The KB article page template includes a page properties web part that shows the Knowledge Type, Contact and Topic.

The layout of each KB article page template is as follows:
One-third right section: Text web part (left), Page properties web part (right)
One column section: Two text web parts
One column section: Two text web parts

How to create a page template

  • Create or open the page you want to use as your template
  • Press the down arrow next to the save button > Save as template

Page templates will now appear under saved on this site when creating a new page. Templates are also saved in a “Templates” folder within the Site Pages library.

Create page templates to standardise how knowledge is created.

More information on how to manage and delete templates can be found here.

Issues & next steps

Dependant drop-down lists, Power Apps and the Site Pages library

One area I would like to improve on is including the ability to have dependant drop-downs for Technology, Application and Product when applying metadata to KB articles. When creating the KB, I did work on two ways to achieve this- but they both fell short in the end.

My first attempt was to customise the Site Pages library new and edit forms using Power Apps. I used this article by Microsoft on how to create dependent drop-down lists in a canvas apps as a starting point, but had to make some changes to account for the additional third level of drop-down. Although I got this working within the context of PowerApps, I had to abandon this method as creating new pages in the Site Pages library via Power Apps is not supported. My experience was that once I customised the form in Power Apps, it pretty much broke the Site Pages library. I was unable to create new pages and it would default to an old style wiki page and not let me create modern site pages.

Custom forms for document libraries only supports editing custom metadata. Editing or managing file(s) is not supported.

https://docs.microsoft.com/en-us/connectors/sharepointonline/

After this failed, I also tried an older way of doing this by using JQuery and SPServices as described here.

Initially I got this to work too, but it was also a pretty poor solution when working with modern pages as the only way to actually get to the dependent drop-downs was by pressing “Edit all” which took you to the classic version of the edit properties page.

Aside from this, you also have to jump through several hoops to add in the old content editor web part, which are too numerous to describe in this post but have linked to one of them.

There was also a recent change to how classic forms work with modern lists that stopped this method working all together. Although this seems to be resolved, my understanding is you have to set your list to run in the classic experience in order to get this method to work – so I’ve scrapped this too!

I currently have no solution for dependant drop-downs, but am open for suggestions that are low code or relatively easy to implement. Feedback so far from users is that they aren’t all that bothered about it as the process to apply metadata is easy.

Images not updating when refreshing

As I was in the process of updating the KB homepage I noticed that when replacing some of the images or other assets that make up the page, they weren’t visibly updating after a forced browser refresh. I wrote a separate post called how to force images to update in SharePoint Online which details how to resolve this.

Updating the modern search solution

When I began building the KB I deployed what is now version 3 of the modern search solution. Since then the PnP team have created PnP Modern Search V4, I’ve personally decided not to update my search solution as at the time of writing V4 doesn’t support suggested keywords which is a part of my solution.


14 responses to “How to build a knowledge base in SharePoint”

  1. How did you get round the issue of your Site Pages Library containing all your other site pages (Like home.aspx and any other pages you are creating outside of the KB articles? All those pages would also end up needing Product / Application meta, even though it wasn’t relevant? (You could leave them blank, but most of the time you want these fields to be mandatory)

    1. Hi Oliver, thanks for the comment. I had a type for non-KB pages that I applied before hand and filtered them out the views

      1. Thanks for your reply! That makes sense. So I guess it isn’t possible to make those Meta columns mandatory, without then meaning that every time you create a new site page (whether it’s an EKB or not), you’d HAVE to complete the Tech / Application /Product fields etc.

        Not a dealbreaker for me, but not looking forward to a bunch of orphaned EKBs where contributors don’t bother to complete all the info! 🙂

      2. Well I think you can make them mandatory, for me I haven’t ended up creating that many additional site pages since launching, so for me i just retrospectively added the metadata for the site pages, then made the fields mandatory going forward.

        It’s worth the minor headache for ensuring users fill in the info in my book!

  2. Hi Anthony. This is amazing! Can you give me an example of a CAML query to show pages with Technology (column) Microsoft (in lookup list) or similar?

    Also, on the browse by pages how could one add a filter end users could use to show only Excel or only Sharepoint Online, etc?

    1. Hi, thanks for the comment! For the CAML query ping me an email anthony@sharepointstuff.com as I can’t copy/paste code in the comments section for some reason.

      For the filtering, in my KB I’ve just pinned some key columns to the filters pane and do it that way. If you wanted to get clever with it you could create a list with your filter values in, create a page and use dynamic filtering to only show the relevant site pages based on the selected list item. I haven’t got an article on it myself yet, but there are some good dynamic filtering examples out there.

  3. I’m using v4 and having a couple of issues

    The first is getting results from the local site. It is instead picking up results from the whole SPO.
    I tried using the format you mentioned but it didnt work.

    {searchTerms}
    Path:{Site.URL}
    FileType=aspx

    The second is that I can’t get to send the result from the search bar on the home page to ‘dedicated search page’ where there is another search bar and a results section.
    the search bar on the home page does redirect to the other page but it doesn’t bring the result query with it.

    Not sure what I’m doing wrong.

    Any suggestions?

    1. My example uses V3 of the PnP search solution and I know it’s quite different so what I’ve documented won’t necessarily work the same. There documentation is really good though https://microsoft-search.github.io/pnp-modern-search/

  4. Great article – many thanks.

    Under the browse by category section, how do you display results on those pages?
    Are those somehow getting populated by the metadata or do you manually edit the pages and add relevant pages and new entries?
    e.g what does it look like when someone clicks “By Technology”?

    1. Hi, thanks for the comment! Apologies I don’t think I explained the pages very well in my post. I have a series of pages I’ve created (eg. Technology) that basically the site pages library embedded as a web part, with the relevant view selected.

      I’ve also added a highlighted content webpart, also filtered using CAML queries to show the latest posts per page.

      When I get chance I’ll update the post with a better explanation of this but hope that helps

  5. Thank you so much for the info in this post! Pretty much exactly what I was looking for. Could you tell me what site template you started with? I’m assuming that you may have started with a Custom site then applied everything to it but am not sure.

    Thanks!

    1. Hi Robert, thanks for the comment! I started with the news, resources, actions template and then applied a custom theme after.

      Thanks,
      Anthony

      1. Thanks, Anthony! I will give it a shot. I like your approach vs that of just a “glorified” wiki.

      2. Thank you! We’ve been using it in my organisation for a while now and the additional of a scoped, predictive search really helps the whole thing. Good luck and if you get stuck or have any questions just comment and I’ll try to help

Leave a Reply

Recent posts

Discover more from SharePoint Stuff

Subscribe now to keep reading and get access to the full archive.

Continue reading