Implementing Alphabet Facets in Sitecore Search for Better Content Navigation

Implementing Alphabet Facets in Sitecore Search for Better Content Navigation

By admin July 20, 2025

When building content-heavy websites with Sitecore XM Cloud, providing users with intuitive ways to browse and discover content is crucial. Alphabet facets allow users to filter content by the first letter of specific fields, making it easy to browse through large content collections.

The Challenge

Our content editors were facing several navigation challenges:

  • Large content catalogs with hundreds or thousands of items were difficult to browse
  • Users often knew the general name of content but not exact keywords
  • No intuitive way to browse content alphabetically by product names, article titles, or other fields

Sitecore Search Custom Alphabet Attribute

We created a custom attribute in Sitecore Search called alphabet_letter that we populate using the document extractor. This field extracts the first letter of the title and stores it for efficient filtering.

The Solution: Alphabet Facet Component

Our implementation creates a reusable alphabet navigation component that integrates with Sitecore Search. The component displays all letters A-Z and highlights which letters have available content.

Implementation Details

Here's how we implement the alphabet facet in our FacetList component:

// Check if this is an alphabet facet
const isAlphabetFacet = facet.name === 'alphabet_facet' || facet.name === 'alphabet';

// For alphabet facets, create complete A-Z list
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
const alphabetFacetMap = new Map(
  facet.value.map((v: { text: string; count: number; id: string }) => [v.text, v])
);

// Create complete alphabet list with counts
const completeAlphabetFacets = alphabet.map((letter) => {
  const existingFacet = alphabetFacetMap.get(letter);
  return existingFacet || { id: letter, text: letter, count: 0, selected: false };
});

// Use complete alphabet for alphabet facets
const displayItems = isAlphabetFacet ? completeAlphabetFacets : filteredItems;

Search Configuration

Configure the alphabet facet in your search request:

// Configure facets with specific settings for alphabet facet
const configuredTypes = types.map((type: any) => {
  if (type.name === 'alphabet_facet' || type.name === 'alphabet') {
    return {
      ...type,
      max: 26, // Ensure all 26 letters are returned
    };
  }
  return type;
});

request.setSearchFacet({ types: configuredTypes });

Key Benefits

  • Intuitive Navigation: Users can quickly jump to content starting with specific letters
  • Content Discovery: Helps users discover content they might not have found through search
  • Performance: Efficient filtering reduces the number of results to process

Conclusion

Alphabet facets are a powerful addition to any Sitecore Search implementation, providing users with an intuitive way to browse and discover content. By implementing a custom alphabet attribute and facet component, you can significantly improve the user experience on content-heavy websites.

Featured Blogs