A template project to build a short URL manager with Eleventy
1y is a short URL manager built with Eleventy (a.k.a. 11ty), the great JavaScript/Node based Static Site Generator.
This is not a URL "shortener", as it doesn't process anything. Short and long versions of URLs are managed manually, so that short URLs can be "beautiful".
1y generates redirection rules from your set of data, each URL being stored in a Markdown file:
fileSlug
of the Markdown file (the filename without the extension in 11ty language) is the short URL. For example, the Markdown file nho.md
you'll find in this template repository is used to create the https://<your-short-domain>/nho short URL.nho.md
file only contains these 3 lines:
---
url: https://nicolas-hoizey.com/
---
So for this example, when you go to https://<your-short-domain>/nho, it redirects you to https://nicolas-hoizey.com/.
If you don't want to manage many Markdown files for your short URLs, you can try Suri, another Eleventy based short URL manager, which uses one single JSON file.
Redirection rules are generated in 4 formats to ease usage on different environments:
.htaccess
file.htaccess
file_redirects
file<meta>
tag) and JavaScript Redirect. This is only meant as a last resort, only there if previous formats don't work. Your HTTP server needs to be able to respond to https://<your-short-domain>/nho with this actual ressource: https://<your-short-domain>/nho/index.html
You don't have to deal with any settings to chose which one to use, all 4 formats are generated at once.
This repository is intended to be used as a template for creating your own repository.
Clicking the button above will:
Each time you push changes to your Github repository (or add files directly with Github's Web interface), Netlify will build the new redirection files.
npm
yet, install npm
npm install
urls/
foldernpm run build
Generated files to deploy are in the _site
folder.
You are welcome and encouraged to make changes to this website by submitting pull requests!
Copyright (c) 2020-present, Nicolas Hoizey