Notion-integrated, Dockerized redirect API written in Go. Supports optional analytics integration with ivynya/analytics
.
Property Name | Description |
---|---|
Name |
The name of the redirect. Can be anything. |
Short |
The short URL to redirect from. May include / characters. |
RedirectURL |
The URL to redirect to. |
CampaignID |
The analytics campaign ID (see ivynya/analytics ). |
The Short
property describes which route to map to the RedirectURL
. For example, in the picture above, if you were hosting this redirect instance on example.com
, then https://example.com/github
will redirect to https://github.com/ivynya
. The Short
property can be prefixed with a /
, like /github
, or without and both will work. It can contain multiple /
characters, like /github/sponsors
.
The CampaignID
integrates with an ivynya/analytics
instance. It corresponds to the CampaignID
specified in an analytics campaign, and will track the number of times the link is accessed. It is OK to leave blank, but must be left blank if no analytics instance was configured in the environment.
Other properties do not have an effect on the redirect. Additional properties may be added to the Notion table (e.g. a multi-select for better grouping and sorting) and will not affect the redirect. However, modification of existing column names or types will break the redirect, so be careful.
⚠️ If you are upgrading from redirect V1 and using an older analytics instance, when configuring redirect v2 you must specifyANALYTICS_VERSION=v2
in your .env file. If you are using the latest Go-based analytics instance, you can specifyv3
instead.
- Duplicate this Notion page and find the database ID
- Create a new Notion integration, copy the API token, and invite it to your duplicated Notion page
- Clone this repo and create a
.env
file with the ID and token, according to.env.example
- Optionally, if running an
ivynya/analytics
instance, add the info of the analytics server (ex:analytics.example.com
andv2
) - Run
docker run --env-file .env -p 3000:3000 -d ghcr.io/ivynya/redirect:latest
- Visit
http://localhost:3000/github
to test it works.
redirect
will automatically update the redirects when the Notion page is updated. At an absolute maximum, this takes 30 seconds as the database query is cached in-memory.
Invalid redirects will return a 404 not found error.
MIT