Install the widget

The script tag and the three ways to open the panel.

The widget is one script. Add it once per page, before </body>:

<script async src="https://cdn.whatsnew.xrisstech.com/w.js" data-key="pk_your_public_key"></script>

async keeps it from blocking your page. The widget loads your feed when the browser is idle, only to compute the badge. Find your key and a ready-made snippet under Install in the dashboard.

There are three ways to open the panel.

Floating button

The default. A round button with a bell and the unread badge, fixed to a corner of the page.

<script async src="https://cdn.whatsnew.xrisstech.com/w.js" data-key="pk_your_public_key" data-position="bottom-left"></script>

data-position is bottom-right (default), bottom-left, top-right or top-left.

Bell button

A bell for your own header or toolbar. Place an empty button where it should appear and turn off the floating button:

<button data-whatsnew="bell"></button>

<script async src="https://cdn.whatsnew.xrisstech.com/w.js" data-key="pk_your_public_key" data-launcher="none"></script>

The widget draws a bell in the button, in the surrounding text color, and puts the unread count on its corner. The panel opens right below it.

An unstyled button gets a 36 px transparent icon button. Give it a class or style to style it yourself; the widget then keeps your look and only adds the icon and the badge.

Your own element

Any element with data-whatsnew opens the panel and gets a small badge with the unread count:

<button data-whatsnew>What's new</button>

<script async src="https://cdn.whatsnew.xrisstech.com/w.js" data-key="pk_your_public_key" data-launcher="none"></script>

To show the count somewhere else, for example inside your own menu item, add an element with data-whatsnew-badge. The widget writes the count into it and hides it when there's nothing new:

<a href="#" data-whatsnew>Updates <span class="my-badge" data-whatsnew-badge></span></a>

Clicking elements added later, as in single-page apps, opens the panel too; their badge appears the next time the count updates.

Single-page apps

Add the script tag to your HTML template once; the widget survives client-side navigation. To remove it, for example on a logout page, call WhatsNew.destroy().

An npm package with an init() function is coming soon. Until then, use the script tag.

Content Security Policy

If your site sends a CSP header, allow the widget's origin for scripts and requests:

script-src https://cdn.whatsnew.xrisstech.com;
connect-src https://cdn.whatsnew.xrisstech.com;

Images in your posts load from where they're hosted (img-src). The widget's styles live in its Shadow DOM.