0

I have used social_share_button_tag in my rails 4 application to share news to facebook, twitter and google plus and customized the title. The code segment is given below:

<%= social_share_button_tag(@abc.full_name,
url: "#{@abc.page}?action=xyz&record=#{@abc.id}",
desc: @abc.full_name,
popup: 'true',
'data-facebook-title' => "The news of #{@abc.full_name}",
'data-twitter-title' => "The news of #{@abc.full_name}",
'data-google_plus-title' => "The news of #{@abc.full_name}",
'data-facebook-caption' => "The news of #{@abc.full_name}"

) %>

For facebook and twitter it's working fine but for google plus the title is not showing. it is showing something else ( may be auto populate some default).

In the documentation it is clearly mentioned that:

Apart from the default title, you can specify the title for the special social network:

<%= social_share_button_tag(@post.title, 
'data-twitter-title' => 'TheTitleForTwitter') %>

Now what should I do?

sa_kader
  • 3
  • 3

1 Answers1

0

The Google+ share endpoint API only accepts url (the URL) and hl (the language code). You can't set a custom Title. To set the title you have to populate the +Snippet in the HTML of the page being shared.

abraham
  • 46,583
  • 10
  • 100
  • 152