我有一个 django 模板,它应该生成一个 twitter 网络意图共享 URL:
<a href="https://twitter.com/intent/tweet?text={{ block.value|urlencode }}%26url={{ page.get_site.root_url|urlencode }}{{ page.url|urlencode }}%26via=pathtweets
我的理解是,如果所有内容都正确编码,则 URL 应自动缩短为 t.co URL。那是对的吗?
如果是这样,我做错了什么?
在所示的模板中,最终文本呈现为:
https://twitter.com/intent/tweet?text=Nostrud%20voluptate%20tempor%20eu%20elit%20laborum%20do%20excepteur%20commodo%20ipsum%20veniam%20velit%20minim.%20Proident%20irure%20velit%20enim%20tempor%20labore%20voluptate%20laboris%20esse%20excepteur%20nostrud%20et.%20Fugiat%20cillum%20magna%20reprehenderit%20qui%20irure%20sint%20in%20occaecat%20officia%20cillum%20proident%20elit%20ea%20pariatur.Nostr%26url=http%3A//localhost/en/my-article-2/%26via=pathtweets
在 URL 中,推文框的内容呈现为:
Nostrud voluptate tempor eu elit laborum do excepteur commodo ipsum veniam velit minim. Proident irure velit enim tempor labore voluptate laboris esse excepteur nostrud et. Fugiat cillum magna reprehenderit qui irure sint in occaecat officia cillum proident elit ea pariatur.Nostr&url=http://localhost/en/my-article-2/&via=pathtweets