├── .nvmrc ├── .gitignore ├── robots.txt ├── .eleventyignore ├── logo.png ├── urls ├── example.md ├── nho.md └── urls.json ├── favicon.ico ├── netlify.toml ├── redirects.njk ├── 404.md ├── .eleventy.js ├── .github ├── .kodiak.toml └── workflows │ └── upgrade-dependencies.yml ├── _includes ├── html-redirect.njk └── default.njk ├── index.md ├── htaccess.njk ├── package.json ├── LICENSE.md ├── safari-pinned-tab.svg └── README.md /.nvmrc: -------------------------------------------------------------------------------- 1 | 16 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | _site/ -------------------------------------------------------------------------------- /robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Allow: / 3 | -------------------------------------------------------------------------------- /.eleventyignore: -------------------------------------------------------------------------------- 1 | README.md 2 | LICENSE.md 3 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nhoizey/1y/master/logo.png -------------------------------------------------------------------------------- /urls/example.md: -------------------------------------------------------------------------------- 1 | --- 2 | url: https://www.example.com/ 3 | --- 4 | -------------------------------------------------------------------------------- /urls/nho.md: -------------------------------------------------------------------------------- 1 | --- 2 | url: https://nicolas-hoizey.com/ 3 | --- 4 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nhoizey/1y/master/favicon.ico -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | command = "npm run build" 3 | publish = "_site" 4 | -------------------------------------------------------------------------------- /urls/urls.json: -------------------------------------------------------------------------------- 1 | { 2 | "permalink": "/{{ page.fileSlug }}/", 3 | "layout": "html-redirect.njk", 4 | "tags": "urls" 5 | } -------------------------------------------------------------------------------- /redirects.njk: -------------------------------------------------------------------------------- 1 | --- 2 | permalink: _redirects 3 | --- 4 | 5 | {%- for url in collections.urls -%} 6 | /{{ url.fileSlug }} {{ url.data.url }} 301! 7 | {% endfor %} -------------------------------------------------------------------------------- /404.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Link not found 3 | layout: default.njk 4 | permalink: 404.html 5 | --- 6 | 7 | This link doesn't exist (yet, or anymore), sorry. 8 | 9 | Go [back home](/)… -------------------------------------------------------------------------------- /.eleventy.js: -------------------------------------------------------------------------------- 1 | module.exports = function (eleventyConfig) { 2 | eleventyConfig.addPassthroughCopy("logo.png"); 3 | eleventyConfig.addPassthroughCopy("favicon.ico"); 4 | eleventyConfig.addPassthroughCopy("safari-pinned-tab.svg"); 5 | eleventyConfig.addPassthroughCopy("robots.txt"); 6 | }; -------------------------------------------------------------------------------- /.github/.kodiak.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | [merge] 4 | automerge_label = 'automerge 🤞' 5 | 6 | # https://kodiakhq.com/docs/recipes#better-merge-messages 7 | [merge.message] 8 | title = "pull_request_title" 9 | body = "pull_request_body" 10 | include_pr_number = true 11 | body_type = "markdown" 12 | strip_html_comments = true 13 | -------------------------------------------------------------------------------- /_includes/html-redirect.njk: -------------------------------------------------------------------------------- 1 | 2 |
You should have been redirected to this URL:
8 | 9 | -------------------------------------------------------------------------------- /.github/workflows/upgrade-dependencies.yml: -------------------------------------------------------------------------------- 1 | name: Upgrade dependencies 2 | 3 | on: 4 | schedule: 5 | # https://crontab.guru/#0_8_*_*_1 6 | - cron: '0 8 * * 1' 7 | workflow_dispatch: 8 | 9 | concurrency: 10 | group: upgrade-dependencies 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | upgrade-dependencies: 15 | uses: nhoizey/upgrade-dependencies/.github/workflows/upgrade-dependencies.yml@main 16 | secrets: inherit 17 | -------------------------------------------------------------------------------- /index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default.njk 3 | --- 4 | 5 | **1y** is a short URL manager built with [Eleventy](https://www.11ty.dev/) (a.k.a. 11ty), the great JavaScript/Node.js based Static Site Generator. 6 | 7 | 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". 8 | 9 | It should be really easy to [create your own](https://github.com/nhoizey/1y) now. 10 | -------------------------------------------------------------------------------- /htaccess.njk: -------------------------------------------------------------------------------- 1 | --- 2 | permalink: .htaccess 3 | --- 4 | 5 | # Using Apache's mod_alias if available 6 |
4 |
5 | [](https://github.com/nhoizey/1y/stargazers)
6 | [](https://mamot.fr/@nhoizey)
7 |
8 | ## What is this?
9 |
10 | **1y** is a short URL manager built with [Eleventy](https://www.11ty.dev/) (a.k.a. **1**1t**y**), the great JavaScript/Node based Static Site Generator.
11 |
12 | 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".
13 |
14 | ## How does it work?
15 |
16 | **1y** generates redirection rules from your set of data, each URL being stored in a Markdown file:
17 |
18 | - the `fileSlug` of the Markdown file (the filename without the extension [in 11ty language](https://www.11ty.dev/docs/data/#page-variable-contents)) is the short URL. For example, the Markdown file `nho.md` you'll find in this template repository is used to create the [https://\