Welcome to Zudoku preview! Open a GitHub issue if you have feature requests or find any issues.
Configuration

Search

Zudoku offers search functionality that enhances user experience by enabling content discovery across your site. When configured, a search bar will appear in the header, allowing users to quickly find relevant information on any page.

We currently support two search providers:

Pagefind

Pagefind is a lightweight, static search library that can be used to add search to your Zudoku site without any external services.

While functional for production use, the Pagefind integration is still work in progress and will be improved in future releases and become the default search provider.

To enable pagefind search, configure the search option in your configuration:

{
  search: {
    type: "pagefind",
    // Optional: Maximum number of sub results per page
    maxSubResults: 3,
    // Optional: Configure search result ranking (defaults shown below)
    ranking: {
      termFrequency: 0.8,
      pageLength: 0.6,
      termSimilarity: 1.2,
      termSaturation: 1.2,
    },
  }
}
typescript

Transforming/Filtering Search Results

You can transform or filter search results using the transformResults option. This function receives the search result along with the current auth state and context, allowing you to:

  • Filter results based on user permissions
  • Modify result content
  • Add custom results

The type of result is the same as the type returned by Pagefind's search API.

{
  search: {
    type: "pagefind",
    transformResults: ({ result, auth, context }) => {
      // Return false to filter out the result
      if (!auth.isAuthenticated) return false;

      // Return true or undefined to keep the original result
      if (result.url.includes("/private/")) return true;

      // Return a modified result
      return {
        ...result,
        title: `${result.title} (${context.meta.title})`
      };
    }
  }
}
typescript

For more information about how Pagefind's ranking system works and how to customize it for your content, see the Pagefind ranking documentation.

Inkeep

To add Inkeep search to your site you will need to copy some variables from your Inkeep account setting:

  • API Key
  • Integration ID
  • Organization ID

With these you can then configure the search option in Zudoku Configuration:

{
  // ...
  search: {
    type: "inkeep",
    apiKey: "<your-api-key>",
    integrationId: "<your-integration-id>",
    organizationId: "<your-organization-id>",
    primaryBrandColor: "#26D6FF",
    organizationDisplayName: "Your Organization Name",
  }
  // ...
}
typescript