[RUBY] [Rails 6] Implementation of SNS (Twitter) sharing function

Introduction

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.

environment

Ruby on Rails '6.0.0' Ruby '2.6.5' Introduced Font Awesome

Edit view file

python


<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.

reference

https://www.howtonote.jp/twitter/button/index4.html

I referred to this article. Thank you very much.

Recommended Posts

[Rails 6] Implementation of SNS (Twitter) sharing function
[Rails] Implementation of SNS authentication (Twitter, Facebook, Google) function
[Rails 6] Implementation of search function
[Rails] Implementation of category function
[Rails] Implementation of retweet function in SNS application
[Rails] Implementation of tutorial function
[Rails] Implementation of like function
[Rails] Implementation of CSV import function
[Rails] Asynchronous implementation of like function
[Rails] Implementation of image preview function
[Rails] About implementation of like function
[Rails] Implementation of user withdrawal function
[Rails] Implementation of CSV export function
Rails [For beginners] Implementation of comment function
[Vue.js] Implementation of menu function Implementation version rails6
[Ruby on rails] Implementation of like function
[Vue.js] Implementation of menu function Vue.js introduction rails6
Implementation of search function
Rails search function implementation
Implementation of pagination function
[Rails] Implementation of search function using gem's ransack
Implementation of Ruby on Rails login function (Session)
[Rails 6] Implementation of inquiry function using Action Mailer
Ruby on Rails <2021> Implementation of simple login function (form_with)
Rails implementation of ajax removal
Rails fuzzy search function implementation
[Rails] Implementation of drag and drop function (with effect)
Implementation of sequential search function
Implementation of like function (Ajax)
Implementation of image preview function
[Ruby on Rails] Implementation of tagging function/tag filtering function
[Rails] Implementation of multi-layer category function using ancestry "seed"
Login function implementation with rails
[Rails 6] Pagination function implementation (kaminari)
[Rails] Implementation of multi-layer category function using ancestry "Editing form"
[Rails] Implementation of multi-layer category function using ancestry "Creation form"
Rails sorting function implementation (displayed in order of number of like)
[Rails] Implementation of tagging function using intermediate table (without Gem)
[Rails] Implementation of user logic deletion
[Rails] Implementation of many-to-many category functions
[Rails] gem ancestry category function implementation
[Ruby on Rails] Comment function implementation
[Rails 6] Like function (synchronous → asynchronous) implementation
[Rails] Comment function implementation procedure memo
Implementation of like function in Java
[Rails] Implementation of new registration function in wizard format using devise
[Rails] Implementation of coupon function (with automatic deletion function using batch processing)
[Rails] Implementation of tag function using acts-as-taggable-on and tag input completion function using tag-it
[Rails] Addition of Ruby On Rails comment function
Rails Addition of easy and easy login function
[Ruby on Rails] Follow function implementation: Bidirectional
Implementation of user authentication function using devise (1)
Rails Basic CRUD function implementation procedure scaffold
Implementation of user authentication function using devise (3)
[Rails] Implementation of validation that maintains uniqueness
[Rails] I will explain the implementation procedure of the follow function using form_with.
DM function implementation
[Rails 6] Ranking function
[Rails] Category function
[JQuery] Implementation procedure of AutoComplete function [Java / Spring]
Implementation of GKAccessPoint