Live data from Hacker News

Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

github.com

31–40 of 182 posts

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#31
post #8

You could also push static HTML pages to the git root which have, e.g., https://news.ycombinator.com/ '" /> in the header.

I reckon it'll be possible to "simplify" it even more for an end-user, by making a static site generator generate these redirect HTML files from markdown or a CSV.

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#32
That is quite interesting. Only issue is to rely on Github Issues for it (it might get messy with too many issues opened).

I had this same ~dream of hosting a URL Shortener statically, which lead me to create URLZap. The difference is that it relies on a config file and it can be used on any code repository service https://github.com/brunoluiz/urlzap

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#33

3425 lines in package-lock.json for a "Minimal URL shortener" https://github.com/nelsontky/gh-pages-url-shortener/blob/mai...

even though this isn't really a constructive comment, most of that package-lock.json is build tools. If you remove those and only install production packages it's 27 lines: https://gist.github.com/StefKors/3b43896467d05cb1fb693ed0da9...

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#34
post #28

Brilliant. Works well. But this has a chance of not working since you are doing the redirection client-side. Some addons block 3rd party resources. Looks like you're using the github API and sending the request from the user's browser.

All redirection is client-side. Even 301s are just instructions for the client to open another page, which they are free to ignore.

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#36

That is quite interesting. Only issue is to rely on Github Issues for it (it might get messy with too many issues opened). I had this same ~dream of hosting a URL Shortener statically, which lead me to create URLZap. The difference is that it relies on a config file and it can be used on any code repository service https://github.com/brunoluiz/urlzap

Cool project! Thanks for sharing! Yea the reason why I chose GitHub issues as a "database" was because it is simple to add a short link that manner. Definitely may get messy and there are other shortcomings like the lack of ability to indicate/reuse aliases. The other way to run a URL shortener service with low effort would be to use Firebase. Your idea is a cool one, love it especially since it uses GitHub actions too!

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#37
post #28

Brilliant. Works well. But this has a chance of not working since you are doing the redirection client-side. Some addons block 3rd party resources. Looks like you're using the github API and sending the request from the user's browser.

All redirection is client-side. Even 301s are just instructions for the client to open another page, which they are free to ignore.

Sometimes you have to mentally translate "client-side" into "JavaScript", then whatever you're reading makes more sense.

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#38

Since I am running a URL shortener service https://blanq.io , my two cents: 1. I looked at https://github.com/nelsontky/gh-pages-url-shortener/blob/mai... and it is a basic script that does nothing more than redirection. A lot of URL shorteners on the web do a lot more. Premium ones can track users and route links based on client. 2. Most of URL shortening audience is non-technical and they usually like to pay and fo…

How come I couldn’t find your service when I was looking for alternatives for bitly? The only results I got via Google, product hunt ... services that were overpriced and very limiting (nr of teammates)

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#39

There's a lot of useful stuff to learn from this tiny example, providing you look at it more as a learning exercise than a production enterprise solution! OP, how does this get around CORS?

The github api does not care about your origin so that wasn't something I had to deal with! If I had to deal with something like that, my best option would be to use a proxy server, which would arguably negate the whole point of this "serverless" hack.

Re: Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

#40

Since I am running a URL shortener service https://blanq.io , my two cents: 1. I looked at https://github.com/nelsontky/gh-pages-url-shortener/blob/mai... and it is a basic script that does nothing more than redirection. A lot of URL shorteners on the web do a lot more. Premium ones can track users and route links based on client. 2. Most of URL shortening audience is non-technical and they usually like to pay and fo…

1. What's wrong with a "basic" script?

2. who "likes to pay"? Having a free option is great, no matter whether you're "non-technical" or not...

3. It's hosted on GH Pages. I think they're pretty okay on the scaling front, what do you think?

4. Technically yes, as in "they could switch off GH Pages and the API". Not sure how likely that is. Also, the redirections are saved as GH issues

Post reply on HN