You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Blogger的WhatsApp分享链接中添加换行符?

问题

我在Blogger中使用如下WhatsApp分享链接代码:

<a class='whatsapp' expr:href='&quot;https://api.whatsapp.com/send?text=&quot; + &quot;*&quot; + data:post.title + &quot;*&quot; + &quot; - &quot; + data:post.url.canonical + &quot; - &quot; + &quot;random text&quot;' rel='nofollow' title='Share to WhatsApp'></a>

希望在data:post.title后添加换行符,实现标题与后续内容换行分隔的效果,请问是否有对应的HTML实体可实现该需求?

解答

可以通过URL编码的换行符实现需求,常用的两种编码方式:

  • %0A:URL编码的换行符(LF,适配多数场景)
  • %0D%0A:URL编码的回车+换行(CRLF,兼容更多旧系统)

将编码后的换行符插入到data:post.title之后即可,修改后的代码示例如下:

<a class='whatsapp' expr:href='&quot;https://api.whatsapp.com/send?text=&quot; + &quot;*&quot; + data:post.title + &quot;*%0A&quot; + &quot; - &quot; + data:post.url.canonical + &quot; - &quot; + &quot;random text&quot;' rel='nofollow' title='Share to WhatsApp'></a>

WhatsApp的分享链接会识别这类URL编码的换行,从而达到你想要的标题与后续内容换行展示的效果。

内容的提问来源于stack exchange,提问作者Sulty

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.29 03:42:44