# How should short links be supported in Discourse

**URL:** https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339
**Category:** Feature
**Created:** [May 5, 2014, 11:57pm UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339 "2014-05-05T23:57:21Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Abhishek\_Gupta](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@Abhishek\_Gupta](https://meta.discourse.org/u/Abhishek_Gupta)
#### Post date: [February 6, 2014, 4:04pm UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/1 "2014-02-06T16:04:00Z")

</div>

> [@Contributing to Discourse development](https://meta.discourse.org/t/contributing-to-discourse-development/3823/1):
>
> Mixed projects  
> Share a link to this post dialog should provide a short link option via goo.gl API

If anyone else is not working on it, i would like to work on it, just to be clear, it should work like this right?

1. I type a url, say [www.google.com](http://www.google.com)
2. But this link is shortened by the Goo.gl API to [Google](http://goo.gl/fbsS)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [February 6, 2014, 10:40pm UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/2 "2014-02-06T22:40:11Z")

</div>

Fantastic!

Correct, it is tied to the “share” dialog you get to by pressing the link icon on post, or the “Share” button at the bottom of the post.

When that comes up, with your plugin active, it should contain the goo.gl URL rather than the raw native URL for the topic.

![](https://global.discourse-cdn.com/meta/original/2X/2/2959707fff87f31f9c28efa799b38a3c8fae2576.png)

---

<div class="post-metadata">

### Author: ![Abhishek\_Gupta](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@Abhishek\_Gupta](https://meta.discourse.org/u/Abhishek_Gupta)
#### Post date: [February 7, 2014, 6:33am UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/3 "2014-02-07T06:33:15Z")

</div>

Does it needs to be a plugin?, it will way much easy to implement in core directly,just need to edit 2-3 files only, atm i can add in the core. is that any good?

* * *

And does this is also needed?

 ![](https://global.discourse-cdn.com/meta/original/2X/9/9b394a8b4aeced4a7eeece26c21e9859c2707f3d.JPG)

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [February 7, 2014, 6:44am UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/4 "2014-02-07T06:44:33Z")

</div>

No, I definitely would not appreciate the forum software randomly shortening my links.

Just use the markdown syntax:

```
[link title](http://example.com/)

```

[link title](http://example.com/)

Also, the discussion of that should be moved to a new topic.

---

<div class="post-metadata">

### Author: ![Frank](https://avatars.discourse-cdn.com/v4/letter/f/3d9bf3/32.png) [@Frank](https://meta.discourse.org/u/Frank)
#### Post date: [May 6, 2014, 12:29am UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/5 "2014-05-06T00:29:36Z")

</div>

Love it! Could that be integrated by default meaning any URL cut and paste would auto-magically render to a nice short goog.le URL? Like an option that can be switched on and off but is on by default. Talk about giving your data a break 🙂 good stuff.

---

<div class="post-metadata">

### Author: ![kpfleming](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kpfleming/32/116414_2.png) [@kpfleming](https://meta.discourse.org/u/kpfleming)
#### Post date: [May 7, 2014, 7:57pm UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/6 "2014-05-07T19:57:35Z")

</div>

If this feature is implemented, it definitely needs to be a plugin, and ideally the plugin should allow the admin to select the URL-shortening service to use. I, for one, would not choose Google’s service.

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [May 7, 2014, 8:17pm UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/7 "2014-05-07T20:17:06Z")

</div>

> [@kpfleming](#):
>
> plugin should allow the admin to select the URL-shortening service to use. I, for one, would not choose Google’s service.

I agree with this. The [Drupal Shorten module](https://drupal.org/project/shorten) provides an example of how this can be done. I personally use bit.ly on my site.

---

<div class="post-metadata">

### Author: ![dccohen](https://avatars.discourse-cdn.com/v4/letter/d/cdc98d/32.png) [@dccohen](https://meta.discourse.org/u/dccohen)
#### Post date: [May 7, 2014, 9:20pm UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/8 "2014-05-07T21:20:08Z")

</div>

All of these solutions imply using a 3rd party link shortening service. Why using a 3rd party when the discourse app itself could have been used? This could be: [yourdomain.com/t/foo123](http://yourdomain.com/t/foo123), where foo123 is the string id of the topic. I know this is not super shor like goo.gl, but it is much shorter than the title version.

This requires non-auto-incremental-integer ids for topics. Unlike mysql, postgres is not inefficient when it comes to non integer primary keys. But, rails was written to solve a specific problem: to work with mysql and integer primary keys. And whenever your problem gets deviated from the problem that rails was written to solve, all the magic of rails is replaced with a pile of pain.

Reddit, which is build on postgres, uses random string ids for looking up links. It would be nice to have the same url pattern for discourse.

Another downside of integer ids is that, it exposes some information about your app: I know exactly how many entities your app has.

---

<div class="post-metadata">

### Author: ![Vocino](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vocino/32/85136_2.png) [@Vocino](https://meta.discourse.org/u/Vocino)
#### Post date: [May 7, 2014, 10:13pm UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/9 "2014-05-07T22:13:44Z")

</div>

I agree completely. I think this should be the default behavior. If using an external shortening service API is an added feature, that would be great. However, if it’s your own short URL, at least you know it will be up as long as you want it to be.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [May 7, 2014, 10:20pm UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/10 "2014-05-07T22:20:25Z")

</div>

> [@dccohen](#):
>
> Why using a 3rd party when the discourse app itself could have been used?

Because the odds of Google existing in 20 years are fairly high, whereas the odds of your particular Discourse forum existing .. isn’t? 😉

Basically, don’t break links. It’s bad enough that shortening happens at all, which breaks huge swaths of links when a “shortener” inevitably disappears.. but the best you can do is rely on a very reliable shortener at the center of the Internet, aka. Google.

Choice is fine, but choosing to create your own “service” is a bad idea.

---

<div class="post-metadata">

### Author: ![Vocino](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vocino/32/85136_2.png) [@Vocino](https://meta.discourse.org/u/Vocino)
#### Post date: [May 8, 2014, 10:21pm UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/11 "2014-05-08T22:21:56Z")

</div>

> [@codinghorror](#):
>
> Because the odds of Google existing in 20 years are fairly high, whereas the odds of your particular Discourse forum existing .. isn’t?

If your forum is down the point is moot anyway. Choosing one 3rd party over another is a debate regardless of how much faith one has in one particular company. I agree that Google shortening should be an option but bit.ly is still the service leader.

That’s why I would say offering a built in shortening options is the best route with the ability to use 3rd party APIs like bit.ly or whatever (maybe via plugins) second.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [May 9, 2014, 4:19am UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/12 "2014-05-09T04:19:06Z")

</div>

Bit.ly is indeed the service leader.. of having accounts compromised. 😉

[http://blog.bitly.com/post/85169217199/urgent-security-update-regarding-your-bitly-account](http://blog.bitly.com/post/85169217199/urgent-security-update-regarding-your-bitly-account)

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [June 11, 2014, 3:49pm UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/13 "2014-06-11T15:49:18Z")

</div>

As I just asked [elsewhere](https://meta.discourse.org/t/selecting-post-urls-in-android-web-browser-is-kicking-my/16439): is there an easy way to infer a short URL from the address bar, similar to the `/raw/nnn` format? e.g. `/t/nnn`? Did not work when I tried it, but it seems it should address this question of URL shorteners.

I understand the SEO reasons for having the post title in the URL, but for usability it would be nice to be able to get to it directly. I could then also create a shortening domain myself that forwards folks on to my forum URL, e.g. `kb2.org/t/nnn` to send people to `discourse.kabissa.org/t/nnn` and on to `discourse.kabissa.org/t/big-long-title-that-google-adores/nnn`

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [June 11, 2014, 3:50pm UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/14 "2014-06-11T15:50:43Z")

</div>

Use this:

[How should short links be supported in Discourse - #12 by codinghorror](https://meta.discourse.org/t/-/15339/12)

---

<div class="post-metadata">

### Author: ![tobiaseigen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tobiaseigen/32/539204_2.png) [@tobiaseigen](https://meta.discourse.org/u/tobiaseigen)
#### Post date: [June 11, 2014, 3:52pm UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/15 "2014-06-11T15:52:33Z")

</div>

well, that was quick. 🙂 yet another hidden feature! loving the treasure hunt.

thanks much!

---

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [June 11, 2014, 4:12pm UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/16 "2014-06-11T16:12:08Z")

</div>

FWIW, what you were expecting to work may work in the future.

See also from 8 hrs ago, coincidentally:

[https://meta.discourse.org/t/how-could-i-access-topic-by-id-only/16433](https://meta.discourse.org/t/how-could-i-access-topic-by-id-only/16433)

---

<div class="post-metadata">

### Author: ![dlukefinch](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dlukefinch/32/131650_2.png) [@dlukefinch](https://meta.discourse.org/u/dlukefinch)
#### Post date: [February 19, 2019, 1:10pm UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/17 "2019-02-19T13:10:17Z")

</div>

Is link shortening possible now? Maybe as a plugin? Would be great for my new project.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [February 20, 2019, 3:14pm UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/18 "2019-02-20T15:14:04Z")

</div>

What do you get from short links?

I agree it was useful when Twitter included links in the characters count, but now that they don’t, I see no reason to involve a middleman that will break the link once they get out of business…

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [February 20, 2019, 7:15pm UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/19 "2019-02-20T19:15:44Z")

</div>

Even Google got out of the shortlink business, so that’s a bad sign as well.

> **[Google is shutting down its goo.gl URL shortening service - Engadget](https://www.engadget.com/2018/03/30/google-shutting-down-goo-gl-url-shortening-service/)**
>
> URL shorteners can be both useful and fun. Google's take on the tech launched in 2009, and added a third-party API, the ability to create QR codes and the power to link right to iOS and Android apps. Even Keanu Reeves has a URL shortener named in his...

It seems the only current use for shortlinks is when you expect people to manually type them in, somehow?

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [February 20, 2019, 7:17pm UTC](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339/20 "2019-02-20T19:17:19Z")

</div>

Another use is in bulk sms marketing

They share short links over SMS

[Next page](https://meta.discourse.org/t/how-should-short-links-be-supported-in-discourse/15339.md?page=2)
