Next up in our tour of SharePoint modern web parts is the Highlighted Content web part. This web part can be quite a powerful addition to your SharePoint page. It allows you to display documents and other content from the current site as well as other sites, and filter the results in various ways. It’s similar in function to the Content Search web part found in earlier versions of SharePoint.
When you first add a Highlighted Content web part (HCWP) to your page, the default display is “Most Recent Documents” in a tiled view. This means the 8 most recently modified documents from all document libraries in the current site. The number 8 is probably the default because the document tiles fit nicely 4 across in a full-width page section. So this is a quick way to get a basic aggregation of documents from more than just a single document library – as opposed to the Document Library web part, which only shows files from a single document library.
But you’ll likely wish to configure the HCWP further to customize the results on your page. Let’s look at each section of the configuration pane in turn.
Note: The Highlighted Content web part is only available for SharePoint Online.
Content Source and Type
The default settings for the Content section of the configuration are to display items from This site, of type Documents, and Any Document type.
Source
The Source is where you specify the general scope of the aggregation. This can be the current site, a specific document library on the current site, the page library on the current site. the whole current site collection, specific sites you select, or all sites in the tenant. And if you’re placing the HCWP on a page in a Hub site, then you can also choose All sites in the hub – in fact, it’s the default in that case.
If you select A document library on this site, an additional dropdown will appear which lists the libraries you can select from. Why would you select A document library on this site, when you could do that with the Document Library web part? Well, in the HCWP you can filter and sort the documents in different ways, as you’ll see later.
If you choose Select sites as your source, you’re presented with lists of sites you frequently visit or that you have visited recently. You can click on Show more if the sites you want to retrieve content from aren’t listed. You can select as many sites as you wish.
Type
What appears in the Type dropdown depends upon the Source you selected. For sources such as the current site or site collection, or selected or all sites, you can choose from any built-in content type, such as Documents, Events, or Tasks. You can even select All if you wish to view all types of content from the selected source, but that gets a little messy and somewhat defeats the purpose of a Highlighted Content web part. However, selecting All is a way of including items which are of custom content types.
If you select The page library on this site as your source, then the Type dropdown only allows you to choose Page or News.
You can click on +Add content type if you wish to display content of several types. For example, perhaps you want to display both documents and images.
Note that any custom content types you may have created are not available in these dropdowns.
Document Type
If you selected Documents as the content Type, then you’ll see an additional dropdown which allows you to filter by one or more document types, such as Word or PDF. The default is Any.
Filter and Sort
After specifying the source and type of the content you wish to display, you can then filter and sort the items to show them in a way that is most useful to your team.
Filter
There are a number of filter options, which are all available for whichever content type you selected previously.
If you choose Title includes the words or Content includes the words, then you’ll see a field where you can enter a search term. This can be a single word, or a phrase (no quotation marks needed), but the full word must match. For example, entering meeting will retrieve documents with the word meeting in the title (or content if you chose that option), but entering meet as the search word will not return those documents. A pretty cool feature of this filter is that Content includes the words will work even on images, such as scanned receipts.
The Recently added and Recently changed filters give you the option to choose how recent, such as Yesterday, or Earlier this year.
However, there isn’t a way to enter a custom timeframe, such as a date range.
The Created by and Modified by filters allow you to choose either Current user (the person viewing the page) or Selected user. If you choose Selected user, then you can enter a specific user’s name, although the field doesn’t resolve users, so you must enter their full first or last name, similar to the “includes the words” options described above.
Finally, you can filter by Managed property if none of the other options are appropriate.
Managed property is a term used by SharePoint Search to mean fields which have been crawled by Search and are available with certain attributes. It’s a very flexible and powerful way to refine the results, but it does require some knowledge of SharePoint Search concepts, especially if you wish to filter by a custom column. Note also, that you can use the Managed property filter to refine results by a custom content type. A discussion of filtering by managed properties is beyond the scope of this article, but you can read about it in this Microsoft document.
You can click on +Add filter to add as many filters as you like, but you should be aware of how they interact. Generally, two filters of the same type will be combined with OR, whereas filters of different types will be combined with AND. For example, you could configure filters to show items which are Created By Sally OR Created By John, AND Title includes the word meeting OR Title includes the word minutes.
August 2019 update: Custom query filtering is now available for the HCWP. This is the ability to add AND/OR clauses within your queries, as well as referencing custom properties you’ve applied to your content. This is now possible with the new custom query option, as you can add your own KQL or CAML code. We take a closer look at this feature in a separate post.
Sort
Next, you can sort the filtered results in a number of ways.
Most recent is the default, meaning the most recently modified. Most viewed sort order is based on number of user views of the item, presumably overall rather than during some recent timeframe. Trending would indicate relevance to the current user based on popularity and relationships, but it’s a bit unclear as to exactly what that would display. The two Managed Property sort options allow you to sort by a SharePoint Search Managed Property, even if you’re not filtering by it.
Audience targeting
A fairly new feature is the ability to display only items targeted to the audience (Office 365 group or Azure Active Directory group) of which the current user is a member.
To use this option, you would need to have modern audience targeting (also a fairly new feature) enabled in the lists or libraries containing the content, and have selected an audience for items within the list or library. Using modern audience targeting is a topic for another day…
Layout
Lastly, the Layout section is where you can choose a general layout for the web part, as well as the number of records to display, and even whether or not to display the web part at all if no results match the criteria you’ve set.
Here’s what you get in each layout type:
- Cards (the default): preview image if one is available, site name, title, and most recent modification date (and by whom, including their profile picture)
- List: basic list format, showing a document icon, title, and the modified date
- Carousel: preview images with arrows to advance from one to the next, and with the title and site name beneath. This layout really only makes sense if you’re sure the items being displayed will have preview images.
- Filmstrip: similar to Carousel, but shows multiple images on each “page”, depending on the width of your web part. In addition, it displays a bit more information: it includes the most recent modification date and user name and profile picture.
By the way, the title of the web part will automatically reflect configuration choices you’ve made (for example, it might say Most Viewed Pages, if that’s what you’ve configure). But you can just enter your own title right on the page if you wish.
Conclusion
As you can see, the Highlighted Content web part is a great way to display any type of content on your page, in nearly any way you wish.
However, if you find the Highlighted Content web part doesn’t quite meet your needs for more complex or customized content aggregation, take a look at our Lightning Conductor web part. It allows you to sort, group, and filter any type of content by any column, in any way you wish.