301s
A static URL shortening and link management project.
To add a shortlink edit one of the urls.*.js
script in /assets/js/ and add a short code and it link as a key value pair. shortcode : "your actual link"
.
Then open a PR to master here. Your PR will be reviewed if it ok your PR will be merged into master and your shortlink will be available at https://301s.github.io?shortcode
E.g assume your shortcode is dc
and your link is https://www.patreon.com/devcareer
. Edit one of the url.*.js
script in /assets/js/ add your shortlink detail in the format below:
const urlMap1 = {
//...
dc : "https://www.patreon.com/devcareer",
exit : "https://301s.github.io/"
}
After the PR has been merged into master the link will be available at https://301s.github.io?dc. Anytime the link https://301s.github.io?dc is visited it will redirect to https://www.patreon.com/devcareer.
Note: Add your short code and link before the ‘exit’ link and do not forget the comma after your short code and link.
To view all the short links in 301s visit links
In the file main.js the url is splited with ?
any string after the ?
symbol is taken and ran through the collection of url maps. If the shortcode is present in the project the page redirects to the actual link. E.g. https://301s.github.io?dc will be splited by ‘?’ and the shortcode dc will be checked in the ulr maps for it link, if present it redirects to https://www.patreon.com/devcareer else nothing happens.
Read the instruction above to add a shortlink to the project.
You can support some of this community as they make big impact in the traing of individual to get started with software engineering and open source contribution.
MIT License Copyright (c) 2020 Adewale Azeez - 301s