/drhay.es

My custom shortlink domain.

Primary LanguageJavaScript

drhay.es

Can I make a shortlink site using Netlify's redirecting service?

Yes.

Can I make it dynamically generate from a directory of files, thus ensuring uniqueness and easy additions?

Also yes.

Overview

The Makefile's default target is site/_redirects. That file has a pretty simple format so I'm going to dynamically generate it with a relatively simple Node script.

To add more link targets, add a file to the links directory. The name of the file becomes the shortlink suffix and the contents become the URL that we 301 redirect to.