Live data from Hacker News

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

github.com

171–180 of 182 posts

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

#171

This currently uses about 100KB of JavaScript (over 99KiB of polyfills, about 3KiB of actual code), loading the HTML file, then three JavaScript files, then making an API call to GitHub, then finally doing the actual redirect, by a substantially inferior JavaScript technique. Also, it doesn’t work on IE because the polyfills were insufficient. Yes, this is an interesting technical demonstration of a concept, but it a…

Thank you for the reply! I definitely learnt a lot from your comprehensive replies. Personally, I am just getting started in web development and I have traditionally written everything with the help of frameworks like ReactJS and the like and the abstractions these frameworks provide means I actually don't know the nitty gritty of how things work. Cross browser compatibility or efficiency was definitely not something…

On the topic of service workers, doing it that way is an amusing concept, but service workers are strictly only for optional enhancements—you can’t guarantee the service worker will be run. The best-case scenario is that the second and subsequent links people open could be handled by the service worker.

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

#172
post #129

Earlier quoted context omitted.

"I was always fixated with URL shorteners and always wanted to write one myself. While it would be easy to write one that works with a server, I loved the idea of hosting and running one for free." I felt exactly the same way and did, in fact, build one.[1] It was pretty simple. There's an interesting twist to the particular one I built - it's not specifically a URL shortener, it's a "Universal Shortener".[2] Also no…

What does the "searchable" option mean? I couldn't find anything about it in the faqs.

We're going to make an index page with links on it that cascade down to every code that is published and marked "searchable".

Then google can just find that index page and index every link on it - and all codes marked searchable will be indexed by google.

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

#174
post #79

Earlier quoted context omitted.

Why?

Cuz they are supposed to be called by people building various apps, and it does not make sense to limit the source of the network requests

Their API allows CORS requests from everywhere, what do they need to "step up"?

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

#175
Well, I clicked this link and got disappointed immediatly. Apparently the idea is neither original new nor useful.

Then I got a little offended by myself. Information Theory has stated clearly that universal compression is impossible, and how come that I didn't recall that?

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

#178
post #5

Earlier quoted context omitted.

That’s clever! I once did the same, except I used a static site generator that I would push to Github and deploy on Netlify.

I’d love to know more about how you did this!

I too did exactly same, as linjed here in this thread itself:

https://news.ycombinator.com/item?id=25113154

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

#179
post #100

This is really cool. I think it might even be possible to improve it further so opening an issue isn't even needed. My thinking is you could store the links and the corresponding shortened URL lookups as an element in the HTML source itself. You would have a submit input on the page. User enters the url they'd like to shorten (or is pulled from a param). The JS reads that value and then looks it up to see if it alrea…

Hmm having a GitHub action redeploy the site is not instantaneous and it does take up to 1 minute for the site (and consequently the new short link) to be updated. Nevertheless, that is a sweet idea, and there are other replies that suggested using a static site generator to generate one html file per short link, with each html file containing a "redirect" tag in . This idea can definitely be combined with a GitHub a…

Like this? https://gitlab.com/davch/static-redirect

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

#180
post #131

If you're using github pages you should just structure jekyll such that you can edit data/_links.yml instead of having thousands of users wasting compute power for github api when its not necessary

Like this? https://gitlab.com/davch/static-redirect
Post reply on HN