Facebook刮刀没有在使用PHP和Mysql的商店产品上看到Opengrapth Meta Tags

时间:2018-04-01 12:53:26

标签: php mysql e-commerce opengraph facebook-sharer

我真的希望这个网站上的某个人可以帮我解决这个问题,我一直在寻找几天,但却无法找到解决方案。

我有一个包含100多种产品的电子商务网站,我试图在每个产品上放置一个Facebook分享按钮。我通过single.php显示每个单独的项目,并使用single.php?pid = 52访问此文件,例如来自产品页面。

在单身.php'开头。我有如下:

$file1 = $pid . ".php"; // a reference to a file containing relevant Open 
Graph metadata which is stored on the server

$metadata = glob('images/products/metadata/'. $file1); // Gets the filename from the server a puts it in to an array $metadata[0];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>wish Interiors</title>
<link rel="canonical" href="https://wishinteriors.com/single.php">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="keywords" content="" >
<meta name="description" content="At Wish Interiors, all our reproduction furniture are handmade using the finest craftsmen and quality workmanship so you are sure to get a luxury handmade piece of furniture every time.">
<!--FACEBOOK-->
<?php
require $metadata[0];

require "includes/header-single.php"; // this contains the rest of the header data 

元数据文件包含如下:

<meta property="og:title" content="Bespoke furniture makers" />
<meta property="og:site_name" content="Wish Interiors" />
<meta property="og:url" content="https://wishinteriors.com/single.php" />
<meta property="og:description" content="At Wish Interiors, all our 
reproduction furniture are handmade using the finest craftsmen and quality 
workmanship so you are sure to get a luxury handmade piece of furniture every 
time." />
<meta property="fb:app_id" content="" />
<meta property="og:type" content="website" />
<meta property="og:locale" content="en-US" />
<meta property="og:image" 
content="https://wishinteriors.com/images/products/Fillipo%203seater.jpg" />

图像文件名中的%20是因为名称中有空格,我做了测试,刮刀似乎接受了这种方法。

问题是facebook刮刀只是拒绝看到Open Graph数据,即使我可以看到如果做浏览的视图源也没关系。我想知道的是,有没有另外一种方法可以做到这一点,甚至可以将动态数据发送给刮刀,或者我是否必须为包含标题数据和产品信息的每个产品实际拥有一个页面

0 个答案:

没有答案