npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aptible-custom-helpcenter-search-test

v2.3.14

Published

Algolia's Zendesk Help Center search implementation

Downloads

7

Readme

Version

NOTE FOR PUBLIC RELEASE

This is a public copy of the custom zendesk search for Algolia. It previously used Algolia answers, but now uses the search endpoint instead-- some naming conventions use "answers" however.

This public fork is not currently a supported integration. We will not be providing support for implementation of this public repository.

What is this

The front-end bundle for Algolia's Help Center search experience. It consists of:

  • The autocomplete search present on the homepage with the main search bar as well as on all pages with a smaller search bar on the top right. This is leveraging classic InstantSearch and Algolia Answers for the "best hit".
  • The ticket form request search: when typing in the "Subject" field, search results will display right underneath the input. This is leveraging Algolia Answers.

Searches are happening on 3 indices across 3 apps:

  • Help Center articles
  • Documentation
  • Discourse posts

How does it work

When built and released, the css and js bundles are hosted on jsdelivr. We then add the files to our Zendesk Help Center theme through simple <link> and <script> tags in the theme code editor.

In Zendesk's HC document_head.hbs template, add the styles, replacing @{THE_VERSION} with your prefered version, eg @1 or @1.1.0:

<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/@algolia/algolia-custom-helpcenter-search@{THE_VERSION}/lib/index.css"
/>

In the footer.hbs template, add the javascript:

<script src="https://cdn.jsdelivr.net/npm/@algolia/algolia-custom-helpcenter-search@{THE_VERSION}/lib/index.js"></script>

Configuration

This package does not (at least for now) expose any kind of module or global function in the browser. This means any configuration change must happen through a commit on this repository and then a release.

Almost all of the configuration happens in the src/constants.ts file. There you will find variables that you can change if needed for:

  • Sources (this is where the algolia indices and apps are defined)
  • CSS Selectors (for your autocomplete and ticket form search initialization, default selectors are the one from the default Help Center theme)
  • Placeholder for the autocomplete
  • Base Urls for the search redirections.

Development

To start developing:

  1. Install all dependencies:
yarn

or

npm install
  1. Launch the dev server:
yarn dev

or

npm run dev

You can find everything related to the autocomplete search in src/autocomplete.tsx. We are using Algolia's autocomplete library to develop our autocomplete and are leveraging some styles from DocSearch.

You can find everything related to the ticket form input search in src/ticketForm.tsx. It's basically a mini app written using preact.

You can find the config variables in src/constants.ts. See configuration.

Don't forget to update the tests in src/__tests__if needed. Jest and Testing Library are used for testing.