solareclipse995 / link-shortener

Simple Airtable-backend link shortener

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Screen Shot 2022-02-23 at 5 57 13 PM

Using the free plans across Airtable, Cloudflare, and Github, you can make your own link shortener using a paid domain name.

Instructions

Airtable

  1. Create an instance of the Airtable base
  2. Under the "Short URL" column, customize the formula so it uses your domain name.
  3. If it wasn't created for you already, make an automation as follows:
    • Triggered on record create
    • Script step: Runs this script. Make sure you set an input config variable called "id" to the "ID" field value from the previous step and "recordID" for the Airtable Record ID.
    • Update record step: Table: Links, Record ID: ID from first step, Fields: Code: Get code from previous step. You'll need to test the previous steps first.
    • Test this automation, then turn it on. If it works, you'll get the code field populated on each new row created.
  4. Follow the steps to make a read-only API key.
  5. Update these two lines in your fork to use that API key and the base ID.

GitHub

  1. Fork this repo.
  2. In settings, activate pages using the main branch
  3. Use these instructions to set up your pages site for proper connection to the domain.

Cloudflare

  1. Create a new site pointed at your github pages repo (the one from the fork of this one). Use these instructions if you need help connecting Cloudflare to the github repo.
  2. In Rules, create a URL rewrite transform rule that matches the hostname (your domain), then rewrites the path to just "/" (leave the field blank). That's it. We're just making everything go to root so it hits the index.html in your fork.

If at first you don't succeed, give it about 20m, you may be waiting on Cloudflare/Nameserver updates to propagate.

Issues? File an one in this repo and I'll take a look.

About

Simple Airtable-backend link shortener


Languages

Language:HTML 100.0%