huacnlee / social-share-button

Helper for add social share feature in your Rails app. Twitter, Facebook, Weibo, Douban ...
MIT License
582 stars 309 forks source link

The request to scrape the URL timed out. #198

Closed Afoster2 closed 3 years ago

Afoster2 commented 3 years ago

Trying to share to facebook takes a very long time to load and is FB seems to be ignoring my meta og fields.

Errors from facebook

Curl Timeout             The request to scrape the URL timed out.
Curl Error                  Curl error: 28 (OPERATION_TIMEOUTED)
Inferred Property     The 'og:image' property should be explicitly provided, even if a value can be inferred from other tags.
Missing Properties  The following required properties are missing: og:url, og:type, og:title, og:image, og:description, fb:app_id

reports show.html.haml

- content_for :head do
  %meta{:content => "****************", :property => "fb:app_id"}/
  %meta{:content => "website", :property => "og:type"}/
  %meta{:content => "https://www.floundergiggin.com/ + #{@report}", :property => "og:url"}/
  %meta{:content => "#{@report.title}",:property => "og:title"}/
  %meta{:content => "#{simple_format(@report.title, {}, :sanitize => false)}", :property => "og:description"}/

= social_share_button_tag(@report.title, :url => report_url(@report), desc: @report.title)

I have used this same setup for several projects previously and now they are all doing the same.

Afoster2 commented 3 years ago

Ok found a solution. After more digging, I found this: https://gorails.com/forum/sharing-on-social-network

<% content_for :head do %>
    <!-- Open Graph tags -->
    <meta property="og:title" content="<%= @article.title %>" />
    <meta property="og:type" content="article" />
    <meta property="og:url" content="<%= article_url(@article) %>" />
    <meta property="og:description" content="<%= @article.body %>" />
      <meta property="og:image" content="<%= absolute_image_url(img.attachment.url) %>" />
    <meta property="fb:app_id" content="12345678" />
    <!-- Twitter card property -->
    <meta name="twitter:card" content="<%= @article.title %>">
    <meta name="twitter:site" content="@mytwitter">
  <% end %> 

Solved. I don't know if it was the order in which I had the og tags or if it was removing the #{}