Twitter button do not append site URL

87 views Asked by At
<a class='twitter-share-button' href='https://twitter.com/intent/tweet?text=My%20Message' data-size='large' data-url=''>Tweet</a>

This works great, EXCEPT it adds "http://localhost:3000" at the end of my tweet, even though I specify data-url=''.

How can I get it to not add the URL of the current site at the end?

1

There are 1 answers

0
Derek Hopper On BEST ANSWER

Try this:

<a class='twitter-share-button' href='https://twitter.com/intent/tweet?text=My%20Message&url=/' data-size='large'>Tweet</a>

If you specify a url of / as a query param, it won't include a url in the tweet. I'm not quite sure why it works that way, but it does.