A git backed URL shortener built with Eleventy (11ty) that uses markdown files for redirects.
Click one of the buttons below to deploy your own instance of Gurl:
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run buildThis URL shortener uses markdown files to create redirects, with Git providing version control. The file path becomes the URL slug.
- Create a markdown file at the desired path, for example
src/books/mobydick.md - Add the following frontmatter to configure the redirect:
---
layout: redirect.njk
title: Your Page Title
redirect_url: https://destination-url.com
redirect_delay: 5000 # Delay in milliseconds before redirecting
---
Optional content to display on the redirect page- The
redirect_urlis the destination URL redirect_delaycontrols how many milliseconds to wait before redirecting (default is 0)- Any content in the markdown body will be displayed on the redirect page
/books/mobydickredirects to Moby Dick on Project Gutenberg/articles/tech/eleventyredirects to the Eleventy documentation
You can easily add or edit redirects directly from your browser using GitHub.dev:
- Press
.(period key) while viewing your repository on GitHub to open GitHub.dev editor - Navigate to the
srcdirectory to manage existing redirects - Create new folders and
.mdfiles for new redirects - Commit and push your changes directly from the browser
This makes it extremely easy to manage your URL shortcuts without needing to clone the repository locally.
src/: Source files_includes/: Layout templates including the redirect template_data/: Global data filescss/: Stylesheets- Various redirect markdown files organized in folders
.eleventy.js: Eleventy configuration_site/: Generated site (after building)
Create a netlify.toml file with the following contents:
[build]
command = "npm run build"
publish = "_site"Create a vercel.json file with the following contents:
{
"buildCommand": "npm run build",
"outputDirectory": "_site",
"devCommand": "npm run dev"
}You can use GitHub Actions to deploy to GitHub Pages. Create a .github/workflows/deploy.yml file with appropriate configuration.
By default, Gurl displays only your available links without marketing content or feature descriptions on the home page. This simplified interface is ideal for most deployments.
You can enable the full marketing content using the SHOW_MARKETING_CONTENT environment variable:
Create a .env file in the project root with:
SHOW_MARKETING_CONTENT=true
The project includes dotenv for loading environment variables from the .env file automatically.
Go to Site settings → Build & deploy → Environment → Environment variables and add:
SHOW_MARKETING_CONTENT true
Go to Project settings → Environment Variables and add:
SHOW_MARKETING_CONTENT true
If you prefer to always show the marketing content, you can edit the src/_data/site.js file directly:
module.exports = {
// ... other settings
showMarketingContent: true,
};