# Share Link Shortener

**URL:** https://meta.discourse.org/t/share-link-shortener/251965
**Category:** Theme component
**Tags:** official, share-link-shortener
**Created:** [January 16, 2023, 10:38pm UTC](https://meta.discourse.org/t/share-link-shortener/251965 "2023-01-16T22:38:47Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [January 16, 2023, 10:38pm UTC](https://meta.discourse.org/t/share-link-shortener/251965/1 "2023-01-16T22:38:47Z")

</div>

| | | |
| --- | --- | --- |
| :discourse2: | **Summary** | **Share Link Shortener** adds a checkbox in the share link modal that replaces the share link with a shorter version containing only the IDs of the topic and post. |
| 👓 | **Preview** | [Preview on Discourse Theme Creator](https://discourse.theme-creator.io/theme/Discourse/share-link-shortener) |
| 🛠 | **Repository** | [https://github.com/discourse/discourse-share-link-shortener/](https://github.com/discourse/discourse-share-link-shortener/) |
| 📖 | **New to Discourse Themes?** | [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) |

Install this theme component

> [@](#):
>
> :discourse2: As this is an #official theme component maintained by the Discourse team, #Support, #Contribute > Bug, #Contribute > UX, and #Contribute > Feature requests can be made in the respective categories here on Meta, and tagged with the appropriate theme component tag. Click on a link below to get one started. 👍
> 
> [❓&nbsp; **Support**](https://meta.discourse.org/new-topic?category_id=6&tags=share-link-shortener "Ask for support on configuring and using Share Link Shortener") [🐛&nbsp; **Bug**](https://meta.discourse.org/new-topic?category_id=1&tags=share-link-shortener "A bug report means something is broken, preventing normal/typical use of the theme component") [👀&nbsp; **UX**](https://meta.discourse.org/new-topic?category_id=9&tags=share-link-shortener "Discussion about the user interface of Share Link Shortener, and how features are presented (including language and UI elements)") [💡&nbsp; **Feature**](https://meta.discourse.org/new-topic?category_id=2&tags=share-link-shortener "Discussion about how existing Share Link Shortener features can be improved or enhanced, and how proposed new features could work")

### Features

This theme component is especially useful when sharing Discourse links on platforms that limit the maximum number of characters in a message, like Twitter or Mastodon.

### Screenshots & video

 ![Short link off](https://global.discourse-cdn.com/meta/original/4X/f/4/0/f409409b12d1f0cbd712d624f414f41e13cfef54.png)

 ![Short link on](https://global.discourse-cdn.com/meta/original/4X/9/d/1/9d16d03055e4c1d59ce6f316fe87d83cb3603c19.png)

In action:

### Settings

| Name | Description |
| --- | --- |
| remember preference | Remember if the user prefers shorter links using their browser’s local storage. |

| Translation | Defualt |
| --- | --- |
| short\_link\_label | Short link |

### Development History

ℹ This feature was requested here: [Post Sharing - ability to convert the URL to the short version](https://meta.discourse.org/t/post-sharing-ability-to-convert-the-url-to-the-short-version/251763)

  

> :discourse2: **Hosted by us?** Theme components are available to use on our Standard, Business, and Enterprise plans.

> Last edited by @JammyDodger 2024-06-15T11:37:35Z
> 
> > **Check document**
> >
> > Perform check on document:

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [January 16, 2023, 10:59pm UTC](https://meta.discourse.org/t/share-link-shortener/251965/2 "2023-01-16T22:59:23Z")

</div>

That is pretty sweet! Thanks for making this!

---

<div class="post-metadata">

### Author: ![UnitedFreedom](https://avatars.discourse-cdn.com/v4/letter/u/ac91a4/32.png) [@UnitedFreedom](https://meta.discourse.org/u/UnitedFreedom)
#### Post date: [January 16, 2023, 11:01pm UTC](https://meta.discourse.org/t/share-link-shortener/251965/3 "2023-01-16T23:01:56Z")

</div>

Thank you so much for making this very useful theme component \<3

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [February 6, 2023, 5:17pm UTC](https://meta.discourse.org/t/share-link-shortener/251965/4 "2023-02-06T17:17:41Z")

</div>

I noticed a slight issue. The checkbox creation prevents the link text input content from being selected by default, and unfortunately, I don’t know how to fix it…

That’s a minor issue though. 🙂

---

<div class="post-metadata">

### Author: ![md-misko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/md-misko/32/126315_2.png) [@md-misko](https://meta.discourse.org/u/md-misko)
#### Post date: [February 6, 2023, 6:06pm UTC](https://meta.discourse.org/t/share-link-shortener/251965/5 "2023-02-06T18:06:47Z")

</div>

Shouldn’t the shortened link also include slug placeholder like this:

`https://meta.discourse.org/t/-/251965/4`

I’m pretty sure there used to be issues when linking to the forum from external sites using the shortened link without the slug?

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [February 6, 2023, 6:30pm UTC](https://meta.discourse.org/t/share-link-shortener/251965/6 "2023-02-06T18:30:52Z")

</div>

I’m not aware of these issues.

I remember seeing the formatting without any slug in a piece of official code yesterday or the day before… I don’t remember where but I thought “how, they use the syntax without the `/-/` here” which seemed to be a clue that such URLs seem to be fine. 🤔

If you happen to find a link about potential problems, that would be great 👍

---

<div class="post-metadata">

### Author: ![md-misko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/md-misko/32/126315_2.png) [@md-misko](https://meta.discourse.org/u/md-misko)
#### Post date: [February 6, 2023, 6:44pm UTC](https://meta.discourse.org/t/share-link-shortener/251965/7 "2023-02-06T18:44:49Z")

</div>

> [@Can't navigate back when using urls without post number](https://meta.discourse.org/t/-/197060/4):
>
> Yes please, keep the slug and the id: For example [https://meta.discourse.org/t/cant-navigate-back-when-using-urls-without-post-number/197060](https://meta.discourse.org/t/cant-navigate-back-when-using-urls-without-post-number/197060) That way the link will remain stable. Also this will work but it is not as pretty imo and will cause a redirect. [https://meta.discourse.org/t/-/197060](https://meta.discourse.org/t/-/197060)

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [February 6, 2023, 7:10pm UTC](https://meta.discourse.org/t/share-link-shortener/251965/8 "2023-02-06T19:10:36Z")

</div>

Thanks!

Either I’m not understanding the issue, or it’s not happening anymore. 🙂

Clicking `https://meta.discourse.org/t/1` opens the right topic seamlessly and allows you to go back to the previous URL.

No issue either with external links: [https://unicyclist.com/t/265354/2608](https://unicyclist.com/t/265354/2608)

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [February 7, 2023, 3:52pm UTC](https://meta.discourse.org/t/share-link-shortener/251965/9 "2023-02-07T15:52:25Z")

</div>

That link ia almost 2 years old now. I imagine that may have been fixed up since then.

If you look at the op statement it was more about a post number.

 ![Screenshots_2023-02-07-11-53-42](https://global.discourse-cdn.com/meta/original/4X/c/4/4/c44e625f46dac0c497a7f0d7280044908102e9ef.png)

The top link has /1 where as the other just ends in / so no post number in the link

([Share Link Shortener](https://meta.discourse.org/t/251965/1)) This link goes to post #1 in this topic.

```plaintext
https://meta.discourse.org/t/251965/1
```

([Share Link Shortener](https://meta.discourse.org/t/251965/)) This link has no post number.

```plaintext
https://meta.discourse.org/t/251965/
```

---

<div class="post-metadata">

### Author: ![hoangphuctran93](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hoangphuctran93/32/290976_2.png) [@hoangphuctran93](https://meta.discourse.org/u/hoangphuctran93)
#### Post date: [February 8, 2023, 10:13am UTC](https://meta.discourse.org/t/share-link-shortener/251965/10 "2023-02-08T10:13:00Z")

</div>

You can add more customization to use external shortlink systems, for example I am currently using yourl source code to set-up a website that supports shortlink is [AgentC Shortlink, Verry Simple](https://agentc.asia/s)

---

<div class="post-metadata">

### Author: ![danielabc](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@danielabc](https://meta.discourse.org/u/danielabc)
#### Post date: [March 26, 2023, 4:06pm UTC](https://meta.discourse.org/t/share-link-shortener/251965/11 "2023-03-26T16:06:09Z")

</div>

I loved so much what you did  
but I needed to put an icon next to the date  
to signal to users that they can click  
How do I put an icon there?

@Canapin

---

<div class="post-metadata">

### Author: ![Kartoon](https://avatars.discourse-cdn.com/v4/letter/k/e36b37/32.png) [@Kartoon](https://meta.discourse.org/u/Kartoon)
#### Post date: [May 16, 2023, 1:13pm UTC](https://meta.discourse.org/t/share-link-shortener/251965/12 "2023-05-16T13:13:14Z")

</div>

This suddenly stopped working on my site (to be honest I have no idea when, I don’t use it frequently) but just noticed now it’s not appearing on any of my themes though it’s still enabled on all of them. I know that provides no useful information lol, but any idea?

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [May 16, 2023, 3:25pm UTC](https://meta.discourse.org/t/share-link-shortener/251965/13 "2023-05-16T15:25:49Z")

</div>

After upgrading to the latest version of Discourse, I confirm the component doesn’t work anymore.  
I’d need to have a look at the recent Discourse commits.

It’s a very simple theme component, so if someone wants to have a look and do a PR, it’s also welcomed. 🙂

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [May 18, 2023, 8:26pm UTC](https://meta.discourse.org/t/share-link-shortener/251965/14 "2023-05-18T20:26:03Z")

</div>

This seems like a useful component, so I’ve fixed it and added some updates here:

[https://github.com/Canapin/short-share-link/pull/1](https://github.com/Canapin/short-share-link/pull/1)

 ![image](https://global.discourse-cdn.com/meta/original/4X/9/d/a/9da103d986488d1986f7a518f8d6c62b3aebee7c.png)

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [May 22, 2023, 9:41am UTC](https://meta.discourse.org/t/share-link-shortener/251965/18 "2023-05-22T09:41:46Z")

</div>

The theme component has been updated and is now #official. 🙂  
There’s a new setting as well described in the first post.

I’ve been using Mastodon recently on an instance with limited character numbers, so that might be useful here indeed. 😄

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [May 22, 2023, 10:07am UTC](https://meta.discourse.org/t/share-link-shortener/251965/19 "2023-05-22T10:07:54Z")

</div>

Shoud these two shares, topic and post, work similar way?

 ![IMG_3072](https://global.discourse-cdn.com/meta/original/4X/3/1/2/312e76fc0768161e56f510d758012d54eb4e1bd2.jpeg)

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [May 22, 2023, 10:39am UTC](https://meta.discourse.org/t/share-link-shortener/251965/20 "2023-05-22T10:39:31Z")

</div>

1. Post link : yes, it does.

2. Topic link… It triggers a JS error 😱 Thanks for thinking about that @Jagster 👍

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [May 22, 2023, 10:41am UTC](https://meta.discourse.org/t/share-link-shortener/251965/21 "2023-05-22T10:41:51Z")

</div>

Interesting, kind of. An error opens sharing of iOS instead. Well, not sharing-sharing actually, but this pop-up:

 ![IMG_3073](https://global.discourse-cdn.com/meta/original/4X/0/c/d/0cd3a129c522018ebabf0fdeddd09e785662461c.jpeg)

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [May 22, 2023, 11:34am UTC](https://meta.discourse.org/t/share-link-shortener/251965/23 "2023-05-22T11:34:56Z")

</div>

After trying again, it doesn’t trigger any error anymore.

I’m not sure what the issue was.

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [May 22, 2023, 11:39am UTC](https://meta.discourse.org/t/share-link-shortener/251965/24 "2023-05-22T11:39:49Z")

</div>

I don’t know anything about errors, but I get different view, and I don’t know if it should or should not be that way.

[Next page](https://meta.discourse.org/t/share-link-shortener/251965.md?page=2)
