Search code examples
facebooksharedoctypemeta-tagsscraper

Facebook Share button - Scraper doesn't fetch meta tags


I've been working on this page http://www.btselem.org/hebrew/131606

I decided to add the Facebook Share button, but for some reason whenever I try sharing, the Facebook scraper doesn't manage to get any of the meta tags in the source – it only displays the site's URL. After checking the URL in the facebook developers debugging tool, I got a 206 response code and the following error:

Can’t download - Could not retrieve data form URL.

I also checked the "See exactly what our scraper sees from your URL" option, and it seems the scraper only manages to read out the following line:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">

The weird thing is that this isn't even the DOCTYPE I've got in the page's source. I already tried changing the DOCTYPE to:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">

After I read some older posts saying this should fix the problem, but that doesn't work either – I keep on getting the same line from the scraper. I'll be thankful for any tip or idea you guys have…

I posted the first part of the source, at least the part containing the meta tags. I'll add the whole code if necessary. Thanks in advance,

David.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/" xml:lang="he" lang="he" dir="rtl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>לקסיקון הכיבוש: 67 שניות על... מאחז |בצלם</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta property="fb:app_id" content="142675212478057"/>

<link rel="shortcut icon" href="/sites/all/themes/btselem/images/favicon.ico" type="image/x-icon" />
<meta property="og:site_name" content="בצלם" />
<meta property="og:title" content="מאחז | בצלם" />
<meta property="og:type" content="article" />
<meta property="og:url" content="http://www.btselem.org/hebrew/131606" />
  <link type="text/css" rel="stylesheet" media="all" href="/sites/default/files2/css/css_1458508373fb743060ffb80b43b3d59c.css" />
<link type="text/css" rel="stylesheet" media="print" href="/sites/default/files2/css/css_ff9c22380c0853814b0563da89e16090.css" />

Solution

  • Looks like you're trying to put meta tags into your <body> tag.

    http://developers.facebook.com/tools/debug/og/echo?q=http%3A%2F%2Fwww.btselem.org%2Fhebrew%2F131606

    <!DOCTYPE html>
    <html>
    <body>
    <p>UBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;</p>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    

    This isn't well formed HTML. Fix up the HTML issues and then Facebook should be able to lint your page correctly.