你如何在Twitter共享链接文本中包含主题标签? [英] How do you include hashtags within Twitter share link text?

查看:3123
本文介绍了你如何在Twitter共享链接文本中包含主题标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个网站,其中包含使用 www.twitter.com/share 功能的自定义推文按钮,但我遇到的问题是在推文文本中包含哈希'#'字符。



例如:



http://www.twitter.com/share?url=www.example .com& text =我+上午+吃+#branstonpickel +右+现在

推文文字显示为'我正在吃'并省略哈希之后的一切。



我在Twitter论坛上快速浏览并了解到散列'#'字符不能成为共享网址的一部分。
在< a href =https://dev.twitter.com/discussions/512#comment-877 =noreferrer> https://dev.twitter.com/discussions/512#comment-877 据说:


哈希是URL中的特殊字符(它们标识文档片段) )所以他们以及随后的任何内容都没有被送到服务器。



你需要URLEncode它,所以使用%23


当我尝试第二点时在我的测试链接中:



www.twitter.com/share?url=www.example.com&text=I+am+eating+%23branstonpickel+正确+现在


推文文字出现为'我现在吃%23branstonpickel '字面上包括%23而不是将其转换成哈希值。 / p>

对于这个令人讨厌的问题感到抱歉,但有人知道这是什么我做错了吗?
b $ b任何反馈都会非常感激:)<这是基本的设置:

  https://twitter.com/intent/tweet? 
url =< url to tweet>
text =<发送推文的文字>
hashtags =<逗号分隔的主题标签列表,其上没有#>

这将预先建立一条推文:< text> < URL> < hashtags>



以上示例为:
https://twitter.com /intent/tweet?url=http://www.example.com&text=I+am+eating+branston+pickel+right+now&hashtags=bransonpickel,pickles



以前有一个hashtags参数的错误...它只显示了第一个n-1个标签。目前这是固定的。


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 :)

解决方案

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.

这篇关于你如何在Twitter共享链接文本中包含主题标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆