B
Bonzai 2
Web Parts

Site Directory

Search and browse SharePoint sites using SharePoint Search with typeahead and favourites.

NavigationFeature Parity: 90%

Get Site Directory Working in 3 Steps

10-20 minutes

Prerequisites

  • Bonzai 2 package installed on your site
  • SharePoint sites indexed by search
1

Add the web part

Edit your page and add "Bonzai Site Directory" from the Bonzai category.

2

Configure display options

Open the property pane and configure which site details to display (owner, date, description).

3

Enable features

Toggle on favourites and typeahead search, then publish your page.

Search-based discovery

Site Directory uses SharePoint Search (contentclass:STS_Site) to automatically discover and display sites. No manual list configuration is required — sites are indexed by SharePoint automatically, and users only see sites they have access to.

Smart search with automatic fallback

The web part first tries server-side KQL patterns (free-text, suffix wildcard, and Title prefix). If those return zero results, it automatically fetches a batch of sites and filters client-side so partial matches anywhere in the title, URL, or description still work (e.g. typing bnz will match ModernTeamSite01bnz). SharePoint KQL only supports suffix wildcards natively, so this fallback closes the gap for middle-of-word searches.

When to Use This Web Part

Use this when you need to...

  • Create a searchable site catalog
  • Allow users to find SharePoint sites
  • Enable site bookmarking (favourites)
  • Browse all sites in the organization

Best page locations

  • Intranet homepage — site search widget
  • Navigation hub — all sites directory
  • People & Directory page — site listings

Consider alternatives when...

  • Quick links to specific pages — use Advanced Links
  • Document search — use Document Portal
  • Curated list of sites — use Favourite Sites

Related web parts:

Favourite Sitescurated/bookmarked sites from a listAdvanced Linkscustom link collections

Common Configurations

Full Site Directory

Complete site search with all details

Best for: Dedicated sites page
Configuration
titleAll Sites
itemsPerPage12
showFavouritesOn
showCreatedDateOn
showSiteOwnerOn
showDescriptionOn
enableTypeaheadOn

Compact Site Search

Minimal site finder for homepage

Best for: Homepage widget
Configuration
titleFind a Site
itemsPerPage8
showFavouritesOn
showCreatedDateOff
showSiteOwnerOff
showDescriptionOff
enableTypeaheadOn

Favourites Focus

Quick access to bookmarked sites

Best for: Personal dashboard
Configuration
titleMy Sites
showFavouritesOn
showDescriptionOn
additionalLinkTextView All Sites
additionalLinkUrl/sites/intranet/sites

Best Practices

Enable typeahead for large organizations

Typeahead search helps users find sites quickly in organizations with many sites. Suggestions appear after 2+ characters and are debounced by 200ms. Clicking a suggestion opens the site directly in a new tab (rather than just filtering).

Use Result Source ID for scoping

Configure a custom Result Source GUID to limit which sites appear in the directory. The value must be a valid GUID — invalid values are silently dropped and the default source is used instead.

Hub sites are auto-highlighted

Sites flagged as hub sites in SharePoint are automatically displayed with a "Hub Site" badge on their card. No configuration required — this is driven by the IsHubSitemanaged property from the search index.

Favorites are stored locally

Site favorites are stored in the user's browser local storage (bonzai_site_directory_favorites), providing quick access without server configuration. Note that favorites do not sync across browsers or devices.

Troubleshooting

Still need help? Contact Bonzai Support


Reference

How It Works

Site Directory uses the SharePoint Search REST API (/_api/search/query) with a contentclass:STS_Site filter to discover and display sites. Unlike web parts that require a manually maintained list, Site Directory automatically finds all sites that users have access to. You can optionally scope results using a custom Result Source GUID.

Search strategy (two-phase):

  1. Server-side KQL — Tries multiple patterns in order: free-text withcontentclass:STS_Site, a suffix wildcard (query* contentclass:STS_Site), and a Title:query* prefix. SharePoint KQL only supports suffix wildcards natively.
  2. Client-side fallback — If server-side returns zero results, fetches up to 500 sites and filters locally on title, URL, and description. This enables middle-of-word matches (e.g. bnzModernTeamSite01bnz).

The service tries several selectProperties combinations from most-detailed (Title, Path, Description, Author, Created, LastModifiedTime, SiteId, WebId, WebTemplate, IsHubSite, HubSiteId) down to minimal (Title, Path), retrying with a less-ambitious set if the tenant rejects any managed property. It also falls back from the configured Result Source ID to the default source if the custom source returns an error.

URL filtering: Non-site URLs are automatically excluded from results (.aspx, .docx, .xlsx, .pdf, .pptx,/_layouts/, /forms/, /siteassets/, /sitepages/,/lists/) so only true site roots are displayed.

Site card rendering: Each card shows an auto-selected Fluent UI icon based on the site template (Team/Group → Group, Communication → CommunicationDetails, Hub → HubSite, otherwise SharepointLogo). Hub sites additionally get a "Hub Site" badge. Clicking anywhere on a card (except the favorite button) opens the site in a new tab.

Debouncing: Search queries are debounced by 400ms after typing stops; typeahead suggestions by 200ms and require at least 2 characters. Stale suggestion responses are discarded so only the latest keystroke wins.

Favorites storage: Bookmarked sites are persisted in browser local storage under the key bonzai_site_directory_favorites as an array of{ url, title, addedDate } entries. They are per-user and per-browser.

Property Pane Configuration

Title Settings

PropertyTypeDescription
titleTextWeb part title (default: "Site Directory"). When blank, the title/header row is hidden entirely (including the additional link).
titleIconOptionDropdownTitle icon mode (default: custom / "Select Icon"). Options: "Select Icon" or "None". Setting to "None" removes the title icon.
titleIconNameTextFluent UI icon name (default: SharepointLogo). Only displayed in the property pane when Title Icon is set to "Select Icon".
titleIconUrlTextCustom icon URL. When set, overrides titleIconName. Only effective when Title Icon is not "None".

Data Source

PropertyTypeDescription
resultSourceIdTextOptional Result Source GUID to scope site search results. Must be a valid GUID — invalid values are silently ignored and the default source is used instead.
itemsPerPageSlider (4-50)Number of sites to display per page (step: 4, default: 12)

Display Options

PropertyTypeDescription
showFavouritesToggleShow the favorite star button on each site card (default: On). Users can click to bookmark sites — favorites are stored in browser local storage.
showCreatedDateToggleShow site created date on each card (default: On)
showSiteOwnerToggleShow site owner (Author) on each card (default: On)
showDescriptionToggleShow site description on each card (default: On)
enableTypeaheadToggleEnable search suggestions dropdown while typing (default: On). Shown in the property pane as "Enable Search Suggestions". Suggestions appear after 2+ characters and are debounced by 200ms.

Additional Link

PropertyTypeDescription
additionalLinkTextTextText for a link shown in the header next to the title (e.g., "View All Sites"). Only rendered when both this text and additionalLinkUrl are set (and the web part title is non-blank, since the header row is otherwise hidden).
additionalLinkUrlTextURL for the header link. Opens in a new tab.

Features Checklist

  • ✅ SharePoint Search-based site discovery (contentclass:STS_Site)
  • ✅ Two-phase search: server-side KQL + client-side fallback for partial matches
  • ✅ Typeahead search suggestions (debounced 200ms, min 2 chars)
  • ✅ Suggestion click navigates directly to the site in a new tab
  • ✅ Debounced search input (400ms after typing stops)
  • ✅ Site favorites (browser local storage, per-user / per-browser)
  • ✅ Pagination with ellipsis for large result sets
  • ✅ Show/hide site metadata (owner, created date, description)
  • ✅ Auto-selected site icons based on template (Team / Communication / Hub / SharePoint)
  • ✅ Automatic "Hub Site" badge on hub sites
  • ✅ Non-site URL filtering (excludes .aspx, documents, lists, layouts)
  • ✅ Click card to open site in a new tab
  • ✅ Custom Result Source filtering (validates GUID format)
  • ✅ Graceful degradation of selectProperties across tenants
  • ✅ Configurable title, title icon (Fluent UI or custom URL), and header link
  • ✅ Responsive design with Fluent UI components