# 在 Twitter 上分享链接时，编码后的 slug 无法正常工作

**URL:** <https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758>\
**Category:** Feature\
**Created:** [2018年八月2日 13:23 UTC](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758 "2018-08-02T13:23:06Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![zyouchi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zyouchi/32/99141_2.png) [@zyouchi](https://meta.discourse.org/u/zyouchi)\
**Post date:** [2018年八月2日 13:23 UTC](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758/1 "2018-08-02T13:23:07Z")

</div>

Hello, I would like to ask you about Slug 's Japanese response.

If I choose encoding with slug generation method, the URL will be in Japanese, but when trying to tweet from the site share button, url will not be recognized correctly.

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

Does anyone have a solution?

---

<div class="post-metadata">

**Author:** ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)\
**Post date:** [2018年八月2日 13:25 UTC](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758/2 "2018-08-02T13:25:14Z")

</div>

Could you post a link to a forum where this is happening?

---

<div class="post-metadata">

**Author:** ![zyouchi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zyouchi/32/99141_2.png) [@zyouchi](https://meta.discourse.org/u/zyouchi)\
**Post date:** [2018年八月2日 13:29 UTC](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758/3 "2018-08-02T13:29:07Z")

</div>

Thank you for your quick reply!  
[ytmura.com](http://ytmura.com)

---

<div class="post-metadata">

**Author:** ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)\
**Post date:** [2018年八月2日 13:38 UTC](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758/4 "2018-08-02T13:38:53Z")

</div>

What browser / OS is showing the issue? Can you post steps to reproduce the issue?  
It looks alright to me.

 ![image](https://global.discourse-cdn.com/meta/original/3X/a/c/ac0d045371c08786c957466eaeb54e7303b733dc.png)

---

<div class="post-metadata">

**Author:** ![zyouchi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zyouchi/32/99141_2.png) [@zyouchi](https://meta.discourse.org/u/zyouchi)\
**Post date:** [2018年八月2日 13:41 UTC](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758/5 "2018-08-02T13:41:14Z")

</div>

My problem is that the topic’s URL is not correctly recognized as a URL after being tweeted!  
 ![image](https://global.discourse-cdn.com/meta/original/3X/3/2/32672325aaca1380cb3e4099ab001bf7ec459a0a.png)

---

<div class="post-metadata">

**Author:** ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)\
**Post date:** [2018年八月2日 13:46 UTC](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758/6 "2018-08-02T13:46:10Z")

</div>

Oh, I didn’t try to tweet it. I guess Twitter doesn’t support such URLs. Maybe we should always share the URL without slug in that case.

---

<div class="post-metadata">

**Author:** ![zyouchi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zyouchi/32/99141_2.png) [@zyouchi](https://meta.discourse.org/u/zyouchi)\
**Post date:** [2018年八月2日 13:58 UTC](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758/7 "2018-08-02T13:58:32Z")

</div>

Regarding the choice of encoding with slug generation method, I think that discourse needs to encode url and **shorten it** in terms of posting function to SNS.

---

<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:** [2018年八月3日 00:15 UTC](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758/8 "2018-08-03T00:15:58Z")

</div>

> [@gerhard](#):
>
> I guess Twitter doesn’t support such URLs.

So this is Twitter’s bug, not ours?

---

<div class="post-metadata">

**Author:** ![zyouchi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zyouchi/32/99141_2.png) [@zyouchi](https://meta.discourse.org/u/zyouchi)\
**Post date:** [2018年八月3日 06:40 UTC](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758/9 "2018-08-03T06:40:53Z")

</div>

This is not twitter’s bug.  
When sharing with Twitter, since url is recognized as a character string, Twitter can not be recognized as a URL.

> [@Sharing link on Twitter doesn't work for encoded slugs](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758/5):
>
> My problem is that the topic’s URL is not correctly recognized as a URL after being tweeted! [image]

---

<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:** [2018年八月4日 00:03 UTC](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758/10 "2018-08-04T00:03:09Z")

</div>

So we need to urlencode it before passing off to share?

---

<div class="post-metadata">

**Author:** ![zyouchi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zyouchi/32/99141_2.png) [@zyouchi](https://meta.discourse.org/u/zyouchi)\
**Post date:** [2018年八月4日 03:52 UTC](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758/11 "2018-08-04T03:52:07Z")

</div>

Yes

I think that Chinese and Korean have similar problems as well!

---

<div class="post-metadata">

**Author:** ![zyouchi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zyouchi/32/99141_2.png) [@zyouchi](https://meta.discourse.org/u/zyouchi)\
**Post date:** [2018年八月9日 09:30 UTC](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758/12 "2018-08-09T09:30:51Z")

</div>

When is this bug resolved? 😌

---

<div class="post-metadata">

**Author:** ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)\
**Post date:** [2018年八月9日 19:51 UTC](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758/14 "2018-08-09T19:51:03Z")

</div>

> [@zyouchi](#):
>
> When is this bug resolved?

It is not a Bug, it is a Feature request.

I expect it will be resolved once a suitable Pull Request is submitted.

---

<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:** [2018年八月9日 23:14 UTC](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758/15 "2018-08-09T23:14:18Z")

</div>

@misaka4e21 can you have a 👀 at this?

---

<div class="post-metadata">

**Author:** ![misaka4e21](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@misaka4e21](https://meta.discourse.org/u/misaka4e21)\
**Post date:** [2018年八月10日 01:13 UTC](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758/16 "2018-08-10T01:13:11Z")

</div>

Able to reproduce.

I’m to check it.

---

<div class="post-metadata">

**Author:** ![misaka4e21](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@misaka4e21](https://meta.discourse.org/u/misaka4e21)\
**Post date:** [2018年八月10日 07:19 UTC](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758/17 "2018-08-10T07:19:22Z")

</div>

[https://github.com/discourse/discourse/pull/6257](https://github.com/discourse/discourse/pull/6257)

---

<div class="post-metadata">

**Author:** ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)\
**Post date:** [2019年四月22日 18:55 UTC](https://meta.discourse.org/t/sharing-link-on-twitter-doesnt-work-for-encoded-slugs/93758/18 "2019-04-22T18:55:56Z")

</div>

PR has been merged in August 2018
