今天给大家推荐一款开源的短链接生成工具,不需要服务器,也不需要数据库。这个项目就是 -- gh-pages-url-shortener。
项目使用
1、项目地址:https://github.com/nelsontky/gh-pages-url-shortener
2、fork 这个仓库到自己仓库里。
3、修改404.html的接口地址
修改仓库中的404.html,将GITHUB_ISSUES_LINK改成自己的地址。
var GITHUB_ISSUES_LINK =
"https://api.github.com/repos/{username}/gh-pages-url-shortener/issues/";
4、配置GitHub Pages

可以设置成自己的域名,需要在域名控制台做域名解析。

5、在 issues 上新建一个 issue 上新建一个 issue ,fork后可能没有开启 issue ,需要在setting中开启 issue

需要转换的长链接作为 Issue 的 Title 即可,短链接会自动转换为 GitHub Pages URL/{issue number} 。
例如新建 inssue:

提交后:

short.xxfxpt.top/3 就是压缩后的短链接。
总结
gh-pages-url-shortener 生成短链接很方便的,如果访问 github 比较慢可以将项目部署到 gitee,使用方式都是一样的。感兴趣的小伙伴赶快去试试吧。