Code Monkey home page Code Monkey logo

Comments (10)

troyswanson avatar troyswanson commented on June 7, 2024

Hey @ndarville - your question has several avenues that end in different results, depending on which path you choose to travel.

The easiest way is pretty obvious: use a system that already exists (bitly, tinyurl, is.gd, etc.) to create the short URLs. These services - like anything else on the internet - have the possibility of going under, which would cause those shortened URLs to disappear.

Another way would be to host your own URL shortening service. It's way more involved, but obviously gives you total control over the system. The popular self-hosted URL shorteners (YOURS and phurl) are PHP scripts that live on some server that you are in charge of.

Here's another idea: if you are using GitHub Pages and have a server that you'd like to use to help automate the creation of these short URLs, take a gander at the page_build webhook. This hook fires when GitHub publishes your site to their Pages platform, giving you the ability to create a script that crawls the site as soon as it is built and dynamically create shortened URLs as it come across new pages.

Which route you decide to take depends on the level of effort you wish to trade off for the amount of control you want to have over the system.

Personally, I think URL shorteners are very rarely necessary. The only time I need to shorten a link is when I'm sending a tweet, but Twitter does that automatically through its t.co service.

from jekyll-help.

albertogg avatar albertogg commented on June 7, 2024

@troyswanson @ndarville what about something with jekyll-redirect-from ? I've never used that gem but from my understanding it does redirects from different URLs. I may also be completely wrong.

from jekyll-help.

troyswanson avatar troyswanson commented on June 7, 2024

Same, I've never used it, but I believe it deals with creating redirects within your site, which is only for your own domain. For instance, setting up a "vanity URL" like http://example.com/a-new-hope which would redirect to http://example.com/2014/4/1/star-wars-a-new-hope-review/.

from jekyll-help.

albertogg avatar albertogg commented on June 7, 2024

@troyswanson yes, but it may work for what @ndarville wants; and as you said, that be, e.g. http://example.com/XdFdE would redirect to http://example.com/2014/4/1/star-wars-a-new-hope-review/ he will just need a rake task or whatever script to generate a draft with the redirect_from: and the base64.

from jekyll-help.

parkr avatar parkr commented on June 7, 2024

It would be awesome to have some special keyword built into https://github.com/jekyll/jekyll-redirect-from ... :)

from jekyll-help.

troyswanson avatar troyswanson commented on June 7, 2024

@parkr On second thought, maybe not, huh?

from jekyll-help.

parkr avatar parkr commented on June 7, 2024

Yurrrrp.

from jekyll-help.

ndarville avatar ndarville commented on June 7, 2024

So the parting advice is to not involve Jekyll in the process at all?

from jekyll-help.

parkr avatar parkr commented on June 7, 2024

My parting advice would be to use jekyll-redirect-from and use more semantic short URL's, rather than the base 64 encoded gobbledy-gook we love so much. ;) E.g. My post "The Crime of Net Neutrality and What We Can Do to Fix It", I'd probably shorten that to redirect_from: /net-neutrality or something. Or, if you wish, you can even make up a lil set of nonsense chars: redirect_from: /b32JakI

from jekyll-help.

troyswanson avatar troyswanson commented on June 7, 2024

Bingo. πŸ™Œ

from jekyll-help.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.