Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you include hashtags within Twitter share link text?

I'm writing a site with a custom tweet button that uses the www.twitter.com/share function, however the problem I am having is including hash '#' characters within the tweet text.

For example:

http://www.twitter.com/share?url=www.example.com&text=I+am+eating+#branstonpickel+right+now
The tweet text comes out as 'I am eating' and omits the hash and everything after.

I had a quick look on the Twitter forums and learnt the hash '#' character cannot be part of the share url.
On https://dev.twitter.com/discussions/512#comment-877 it was said that:

Hashes are special characters in the URL (they identify document fragments) so they, and anything following, does not get sent the server.

and

you need to URLEncode it, so use %23

When I tried the 2nd point in my test link:

www.twitter.com/share?url=www.example.com&text=I+am+eating+%23branstonpickel+right+now
The tweet text came out as 'I am eating %23branstonpickel right now' literally including %23 instead of converting it to a hash.

Sorry for the waffely question, but does anyone know what it is I'm doing wrong?
Any feedback would be greatly appreciated :)

like image 508
Splendiferous Avatar asked Feb 03 '12 11:02

Splendiferous


People also ask

How do you hyperlink a hashtag?

Click "Status" on the page and then enter your message and add the hashtag at the end. Press "Ctrl+V" to paste the link to the Twitter hashtag at the end of the message.

How do you add hashtags to Twitter thread?

On Twitter, adding a “#” to the beginning of an unbroken word or phrase creates a hashtag. When you use a hashtag in a Tweet, it becomes linked to all of the other Tweets that include it. Including a hashtag gives your Tweet context and allows people to easily follow topics that they're interested in.

Can you hyperlink words on Twitter?

If you have the URL open in a Web browser, highlight it, press "Ctrl" and "C" simultaneously, then click inside the Twitter text box and press "Ctrl" and "V" at the same time. This will copy and then paste the link.

How do you quote a link in a Tweet?

Step 1: You come across a tweet you want to reply to. Click on the reply button or Click on the tweet your reply option. Step 2: A pop-up will appear in which you can enter your reply. Step 3: Enter your reply + paste a link to a tweet that you want to add.


2 Answers

It looks like this is the basic setup:

https://twitter.com/intent/tweet? url=<url to tweet> text=<text to tweet> hashtags=<comma separated list of hashtags, with no # on them> 

This would pre-built a tweet of: <text> <url> <hashtags>

The above example would be: https://twitter.com/intent/tweet?url=http://www.example.com&text=I+am+eating+branston+pickel+right+now&hashtags=bransonpickel,pickles

There used to be a bug with the hashtags parameter... it only showed the first n-1 hashtags. Currently this is fixed.

like image 87
adamb0mb Avatar answered Oct 10 '22 16:10

adamb0mb


you can use %23 instead of hash (#) in url eg

http://www.twitter.com/share?url=www.example.com&text=I+am+eating+%23branston+%23pickel+right+now

like image 37
Niket Avatar answered Oct 10 '22 16:10

Niket