Tuesday, April 22, 2014

more FB



Checked out the Facebook debugger.
URL Decoder

A canonical link element is an HTML element that helps webmasters prevent duplicate content issues by specifying the "canonical", or "preferred", version of a web page as part of search engine optimization.

Looked at the metadata for the Page
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>_________X | Official Shop of _________X </title>
<meta name="description" content="_________X">
<meta name="keywords" content="_________X">
<meta property="og:title" content="_________X" />
<meta property="og:url" content="https://_________X.com/"/>
<meta property="og:image" content="https://cloudfront.net/assets/logo_color_small.png"/>
<meta property="og:description" content= "_________X"/>
<meta content="_________X.com" name="host" />
<meta content="_________X" name="_________X" />
<meta content="authenticity_token" name="csrf-param" />
<meta content="_________X=" name="csrf-token" />

**Noticed that the meta content for the og:url and the og:image are wrong.
The og:image goes to https://cloudfront.net/assets/logo_color_small.png which is the small logo.

For the og:url
We wrote a new method in the application_helper
  def current_path
    request.original_url
  end
Changed the meta property in the metadata partial

For the og:image
We wrote a new method in the application_helper
  def current_crowdshop_image
    current_inventory.cover.file
  end
Changed the meta property in the metadata partial

Ideas
<meta content="inventories" name="stock[type]" />
request.original_url
original_url() publicReturns the original request URL as a String.

# get "/articles?page=2"

request.original_url # => "http://www.example.com/articles?page=2"

url_for( only_path:  false )

Another idea...
app/views/crowdshops/_socialbar.html.erb
change...
u=

app/decorators/stock_decorator.rb
  def to_facebook
    CGI.escape(to_url)
  end
  def to_twitter
    {
      url: to_url,
      via: "_________X",
      text: "Look at this awesome design!",
      related: h.current_metadata.twitter_id
    }.to_query
  end
  def to_pinterest
    {
      url: to_url,
      media: cover.file,
      description: "#{name} by #{author}"
    }
  end
--------------------------------------------------------------
escape(string)
URL-encode a string.

url_encoded_string = CGI::escape("'Stop!' said Fred")
   # => "%27Stop%21%27+said+Fred"
------------------------------------------------------------------

No comments:

Post a Comment