- No Backend Server Required: Pure static HTML, JS redirects, work anywhere
- Fast Redirects: Instant redirects with progress indicator
- Multiple Redirect Methods: JavaScript redirection with HTML meta fallback
- Index Page: View all registered Short Links in one place.
- Customizable Templates: Design your own redirect pages with dynamic values
- Easy Deployment: Works on GitHub Pages, Netlify, Vercel, or any static host
Configuration is done in config.js file, in an object config :-
exports.config = {
// shortlinks, configurations
}- Add entries in
config.shortLinksobject :-
exports.config = {
shortLinks: {
"exmpl": "https://example.com",
"ig": "https://www.instagram.com",
"kirei": "https://github.com/soymadip/KireiSakura-Kit",
}
}Default options can be changed in the root of config object.
exports.config = {
buildDir: "/output",
template: "my_template.html",
shortLinks: {
"exmpl": "https://example.com",
}
}Here are the available options :-
buildDir: Directory where the generated files will be placeddeploy_path: Base path where the site will be deployed.- Use
/for root domain deployment (e.g., example.com/) - Use
/<sub>for subdirectory deployment (e.g.,/subwill beexample.com/sub/)
- Use
addIndex: Whether to generate an index pagetemplate: HTML template for redirect pagesfavicon: Url or path of faviconmetaDelay: Delay before triggering fallback redirect method
Templates are used to generate the index.html files.
Default template is mostly enough, but in case custom can be made:-
- Add your template html files in
templatesdir. - CSS should be included in the same file either using,
<style>tag, or- inline CSS
- Below vars can be used to get dynamic values:
{{URL}}-> Redirection URL{{DOMAIN}}-> Domain name of redirection URL{{KEY}}-> The shortlink path.{{FAVICON_URL}}-> Favicon URL.
This project can be used alongside of Portosaurus.
To achieve integration, you can use same config.js and options but
- Instead of
configobject's root, useconfig.link_shortener. - Same for defining shortlinks, use
config.link_shortener.shortLinks. - Also an
enablefield for enabling the link shortener.
exports.config = {
link_shortener: {
enable: true,
buildDir: "/output",
template: "my_template.html",
shortLinks: {
"exmpl": "https://example.com",
}
}
}StaticShort includes a built-in development server for local testing:
# Start the development server
pnpm start
# or
npm run startThis will compile your shortlinks and serve them locally for testing before deployment
-
For GitHub Pages,
- just fork this repo
- Go to repo
settings>Pages& selectBuild & DeploymenttoGitHub Actions - Customize as you like.
- Commit your changes & GitHub should do the rest automatically.
- go to
<your username>.github.io/<repo-name>
-
For other platforms,
- Generate static files using
npm run buildcommand - This will generate static files in
builddir. - Simply upload the generated files to any static hosting service:
- Netlify
- Vercel
- Firebase Hosting
- Or any web server that can serve static HTML files
- Generate static files using
-
As this kind of redirection is done at client side,
If tools likecurlorwgetare used, generatedindex.html's content is returned instead of following redirection. -
The codebase is a bit messy, But it gets its job done reliably.
- This project is inspired by urlzap.
- The default templates are created by deepseek R1 hosted using Ollama.
- KireiSakura Kit for the release workflow.
- StackOverflow threads, for providing me support.