# Discourse post direct copy link

**URL:** https://meta.discourse.org/t/discourse-post-direct-copy-link/271993
**Category:** Theme component
**Tags:** deprecated, included-in-core, copy-link
**Created:** [July 18, 2023, 2:18pm UTC](https://meta.discourse.org/t/discourse-post-direct-copy-link/271993 "2023-07-18T14:18:59Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![chapoi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chapoi/32/537252_2.png) [@chapoi](https://meta.discourse.org/u/chapoi)
#### Post date: [July 18, 2023, 2:18pm UTC](https://meta.discourse.org/t/discourse-post-direct-copy-link/271993/1 "2023-07-18T14:18:59Z")

</div>

> ℹ The functionality of this theme component is now included in core Discourse.
> 
> ⚠ **Please remove the theme component from your forum if you still have it installed.**

| | | |
| --- | --- | --- |
| ℹ | **Summary** | Adds a direct-copy button to the post menu actions. |

Install this theme component

A small component that will copy the link of a post directly to your clipboard, circumventing the original share modal popup.

Replaced the share functionality with a direct copy functionality. Same icon, different action.

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/4/5/445657b51919d4b14924a062f4d9a58086eee749.jpeg)

On click it shows a toast notification and a little checkmark on the copy button, to indicate the copy action happened.

⚠ Desktop only – mobile has native copy popup support.

Only the post menu button is impacted, the timestamp and topic share button remain the same.

> **Previous version changes**
>
> - The previous version had similar functionality on mobile, but decided to drop this in favor of the native support.
> - It also had the option to keep the original share-modal button in the post menu actions, but removed that for now to avoid confusion and complexity. So in the latest version, you choose either type A or type B functionality.
> - The toasty was shown in the bottom right corner, but on large screens this was too far from the action, so moved it closer

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [July 18, 2023, 2:32pm UTC](https://meta.discourse.org/t/discourse-post-direct-copy-link/271993/2 "2023-07-18T14:32:44Z")

</div>

> [@chapoi](#):
>
> You can opt to keep the original share button too by unchecking this setting:
> 
> ![image](https://global.discourse-cdn.com/meta/original/4X/f/f/d/ffdd315949f6ee6273b6abe3d19242031177a202.png)

just to clarify, i believe the existing share button is also optional to show in admin-settings under `post menu`? (which of course is the same as clicking the timestamp in top right corner of a post)

---

<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: [July 18, 2023, 2:58pm UTC](https://meta.discourse.org/t/discourse-post-direct-copy-link/271993/3 "2023-07-18T14:58:35Z")

</div>

Indeed, you can completely remove any of these shortcuts, both outside and inside the wrench icon. 🙂

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/f/3/4f3b0659b35d20508f8ba5409b5bbc238d8061c3.png)

---

<div class="post-metadata">

### Author: ![chapoi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chapoi/32/537252_2.png) [@chapoi](https://meta.discourse.org/u/chapoi)
#### Post date: [July 18, 2023, 3:14pm UTC](https://meta.discourse.org/t/discourse-post-direct-copy-link/271993/4 "2023-07-18T15:14:07Z")

</div>

Oh cool TIL.

Regardless, I still think having it disabled in the component by default is probably useful?

---

<div class="post-metadata">

### Author: ![twofoursixeight](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/twofoursixeight/32/574822_2.png) [@twofoursixeight](https://meta.discourse.org/u/twofoursixeight)
#### Post date: [July 19, 2023, 7:26pm UTC](https://meta.discourse.org/t/discourse-post-direct-copy-link/271993/5 "2023-07-19T19:26:13Z")

</div>

When signed out, only the copy button should appear. It would make the anonymous sharing process easier for logged out users and two copy buttons arent needed

 ![IMG_2136](https://global.discourse-cdn.com/meta/original/4X/b/0/4/b0438d7662616d9fe72cddbd642392037eaf5a61.jpeg)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 18, 2023, 4:36am UTC](https://meta.discourse.org/t/discourse-post-direct-copy-link/271993/6 "2023-08-18T04:36:35Z")

</div>

Feedback from @darkpixlz

> [@Option for the legacy Share popup](https://meta.discourse.org/t/option-for-the-legacy-share-popup/275124/1):
>
> I’d love to see it pop up if I click the link button twice,

(it) the old share dialog.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 18, 2023, 4:38am UTC](https://meta.discourse.org/t/discourse-post-direct-copy-link/271993/7 "2023-08-18T04:38:24Z")

</div>

Note @darkpixlz you can still get the dialog today by clicking the time 🙂

---

<div class="post-metadata">

### Author: ![martin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martin/32/491371_2.png) [@martin](https://meta.discourse.org/u/martin)
#### Post date: [December 8, 2023, 1:51am UTC](https://meta.discourse.org/t/discourse-post-direct-copy-link/271993/8 "2023-12-08T01:51:37Z")

</div>

I worked with @chapoi to merge this into core this week, and it’s here now:

> <https://github.com/discourse/discourse/pull/24709/files>
>
> This commit ports the feature by @chapoi that was
> previously a theme component …in core.
> 
> A new post\_menu button, copyLink, is added and used
> as the default instead of share.
> 
> copyLink, on desktop, will copy the link of the post
> to the user's clipboard and show a nice 'lil animation.
> On mobile the native share menu will be shown.
> 
> If site owners want the old behaviour back, they just
> need to change the post\_menu site setting to use
> the share button instead of copyLink.
> 
> !\[image\](https://github.com/discourse/discourse/assets/920448/3edb33f2-3ea3-407e-8c1b-dd687f8284b3)
> 
> Original theme component: https://github.com/chapoi/discourse-post-direct-copy

**You should uninstall this theme component if you have it installed.**

A new `post_menu` button, `copyLink`, is added and used as the default instead of share. If site owners want the old behaviour back, they just need to change the `post_menu` site setting to use the share button instead of `copyLink`.

On desktop, this button will copy the link of the post to the user’s clipboard and show a nice animation. On mobile the native share menu will be shown.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [March 2, 2024, 9:55pm UTC](https://meta.discourse.org/t/discourse-post-direct-copy-link/271993/9 "2024-03-02T21:55:12Z")

</div>

As the functionality of this theme component is now included as a core feature, please create #Support #Contribute > Feature #Contribute > UX #Contribute > Bug topics for any issues you encounter or any suggestions you may have.
