The Share Link Shortener is an official Discourse theme component that adds a checkbox to the share modal, allowing users to generate shorter URLs (e.g., https://meta.discourse.org/t/-/251965/4) for easier sharing on character-limited platforms like Twitter or Mastodon. It includes settings like remember preference to save user choices via local storage, and a customizable label (short_link_label). The component was inspired by a feature request and has since been updated and officially maintained by the Discourse team.
Users praised its utility Heliosurge, UnitedFreedom, and danielabc. Some noted UI quirks, like the checkbox interfering with text selection Canapin, or inconsistent behavior between topic and post sharing on iOS Jagster. A JS error in topic sharing was later fixed awesomerobot.
Discussions also explored whether shortened links should include slugs md-misko, with Canapin confirming they work without them. Suggestions included integrating external shorteners like Yourls hoangphuctran93, adding icons for visual cues danielabc, and enabling defaults or reply shortening meglio. After a temporary break due to Discourse updates, awesomerobot fixed and improved it, leading to its official status Canapin. Mobile platforms use native share modals for posts, while desktop relies on Discourse’s modal awesomerobot.
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.
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.
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…
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
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
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.