We are creating an application that allows you to browse and search for articles. We have implemented a function that allows you to share the content of this article on SNS (Twitter). I will write it as a memorandum.
Ruby on Rails '6.0.0' Ruby '2.6.5' Introduced Font Awesome
<a href="https://twitter.com/share?ref_src=twsrc%5Etfw"><i class="fab fa-twitter-square fa-2x"></i></a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
By adding options such as data-text = "~", it seems that you can set the text displayed in the tweet.
I referred to this article. Thank you very much.