On this page

Host Snaglist on your own server

How-to

Serve snaglist.js from your own server, so your pages load nothing from anyone else and you choose when to update.

Before you begin

  • A web server that serves your site's files, such as nginx, Apache, Caddy, or your app's own static folder.

Steps

  1. Download the version you want into the folder your server serves. This command saves version 0.4.0:
curl -fsSL -o snaglist.js https://raw.githubusercontent.com/TheMightyTRex/snaglist/v0.4.0/snaglist.js
  1. Check it downloaded in full. The file ends with })();:
tail -c 20 snaglist.js
  1. Serve it as JavaScript. Most servers do this already for .js files.
  2. Let browsers keep it for a while. For nginx, this rule keeps it for a day:
location = /snaglist.js { add_header Cache-Control "public, max-age=86400"; }
  1. Add the script tag to your pages: Add Snaglist to a website.
  2. If your site sends a Content Security Policy, Snaglist works under a strict one such as default-src 'self'. It needs no other site, no inline script and no inline styles.

Things to note

  • You can load it from a content delivery network instead, pinned to a version, but that site then receives your visitors' requests:
<script src="https://cdn.jsdelivr.net/gh/TheMightyTRex/snaglist@v0.4.0/snaglist.js" defer></script>

Find out more

This page on GitHub, where the help is written.