Share Link Shortener

: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.
:eyeglasses: Preview Preview on Discourse Theme Creator
:hammer_and_wrench: Repository
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

Install this theme component


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

Short link on

In action:


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

:information_source: This feature was requested here: Post Sharing - ability to convert the URL to the short version

: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 documentPerform check on document:

That is pretty sweet! Thanks for making this!


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


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. :slight_smile:


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

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


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. :thinking:

If you happen to find a link about potential problems, that would be great :+1:

1 Like


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

Clicking opens the right topic seamlessly and allows you to go back to the previous URL.

No issue either with external links:


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.

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

(Share Link Shortener) This link goes to post #1 in this topic.

(Share Link Shortener) This link has no post number.

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

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?


1 Like

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?

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. :slight_smile:

1 Like

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



The theme component has been updated and is now official. :slight_smile:
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. :smile:


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

  1. Post link : yes, it does.

  2. Topic link… It triggers a JS error :scream: Thanks for thinking about that @Jagster :+1:

1 Like

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

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

I’m not sure what the issue was.

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.

1 Like