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

sajari-website

v0.12.0

Published

Website extensions for the Sajari API. Automatically index site content, add user profiles, render search and recommendations, etc.

Downloads

96

Readme

Sajari Website integration (HTML & JavaScript)

Sajari Search is a hosted search and recommendation service supporting instant search, various recommendations widgets and automatic content indexing.

Version License Downloads

This library is UMD compatible, you can use it with any module loader.

If you don't use a module loader, it will export an SJ method into the window object. This is the default install code shown in your Sajari control panel.

Install

To install:

NPM
npm install sajari-website --save

This module is designed for browser integration. It is a wrapper for the base Sajari API module that automatically integrates several key functions:

Automatic indexing

  • Each page view pings back to Sajari to automatically index new & changed page data
  • Feed recommendations widgets with popularity, recency data
  • See more information on Indexing options

Rendering HTML search widgets

  • Simple HTML markup can be used to create powerful search or recommendation integrations
  • Default CSS can be used or modified
  • Rendering options can be controlled easily

Example:

Simple search integration using an overlay to display results:

<input type="search" data-sj-search-query />

Example:

Search integration displaying 5 results within the page (note: results can be placed anywhere):

<input type="search" data-sj-search-query data-sj-maxresults="5" />
<div data-sj-search-results ></div>

Advanced example: Search integration favouring recent and local results, filtering to show only the "bike" category, displaying within the page (note: results can be placed anywhere):

<input type="search" data-sj-search-query data-sj-search-recent data-sj-local data-sj-filter="category,bike" />
<div data-sj-search-results ></div>

Rendering HTML recommendations widgets

Example:

Related (to current page) recommendations integration:

<div data-sj-related></div>

Example:

Popular (site wide) recommendations integration:

<div data-sj-popular></div>

Example:

Related recommendations integration with 3 results, limited to pages where the URL contains "comedy", favour local results (works if pages have a lat-lng):

<div data-sj-related data-sj-local data-sj-maxresults="3" data-sj-filters="~url,comedy"></div>

JavaScript API functionality

  • JavaScript API functionality is wrapped to provide some additional functionality, such as adding in user profile and usage information to recommendation requests
  • See more information on JavaScript functionality