Use Netlify as a URL Shortener

The idea is to have a dedicated repo with only a _redirects file in there which you constantly update and push (and thus deploy). To help automate that, Kent C. Dodds create a package named netlify-shortener which does that for you:

  1. Generates a short code if one is not provided
  2. Validates your URL is a real URL
  3. Adds the URL to the top of _redirects
  4. Runs a git commit and push (this will trigger netlify to deploy your new redirect)
  5. Copies the short URL to your clipboard

The video embedded at the top of this post shows you how to implement this (feel free to fast forward to the 10 minute mark)

netlify-shortener

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.