Facebook Meta标签无法正常工作

时间:2015-08-08 02:24:33

标签: facebook facebook-opengraph meta

我使用了以下内容:

(function () {

  "use strict";

function drawer(price, cash, cid){
    var change = cash - price;
    change = change.toFixed(2);
    change = +change;
    var combine = [];

    var cidMap = [ cid[0], cid[1], cid[2], cid[3], cid[4], cid[5], cid[6], cid[7], cid[8] ];

    var denomMap = [
        100, 'ONE HUNDRED', 20, 'TWENTY', 10, 'TEN', 5, 'FIVE', 1, 'ONE', 0.25, 'QUARTER', 0.1, 'DIME', 0.05, 'NICKEL', 0.01, "PENNY"
    ];

    function display(change) {
        var temp;
        //num = change;//use global variables sparingly, preferably within a namespace, suspect type-o
        var num = change;
        var value = '',
            changeAvailable = function (nameOfCurrency) {
              var queryCash = cid.filter(function (currentCurrency) {
                return currentCurrency[0] === nameOfCurrency;
              }),
                  cashRemaining = queryCash[0][1];
              return (cashRemaining !== 0);            
            };
        for (var i = 0; change > 0 && i < denomMap.length; i += 2) {
            while (change >= denomMap[i] && changeAvailable(denomMap[i + 1])) {
                change += denomMap[i + 1];
                change = change.replace(/\d+/g, "");
                change = change.replace(/\./g, "");
                value += denomMap[i];
                var div;
                   div = Math.floor(num/+value) * denomMap[i];

                if(change === cidMap[0][0] && div > cidMap[0][1]){
                    div = cidMap[0][1];
                    cidMap[0][1] = 0;
                }
                else if(change === cidMap[1][0] && div > cidMap[1][1]){
                    div = cidMap[1][1];
                    cidMap[1][1] = 0;
                }
                 else if(change === cidMap[2][0] && div > cidMap[2][1]){
                    div = cidMap[2][1];
                    cidMap[2][1] = 0;
                }
                 else if(change === cidMap[3][0] && div > cidMap[3][1]){
                    div = cidMap[3][1];
                    cidMap[3][1] = 0;
                }
                 else if(change === cidMap[4][0] && div > cidMap[4][1]){
                    div = cidMap[4][1];
                    cidMap[4][1] = 0;
                }
                 else if(change === cidMap[5][0] && div > cidMap[5][1]){
                    div = cidMap[5][1];
                    cidMap[5][1] = 0;
                }
                 else if(change === cidMap[6][0] && div > cidMap[6][1]){
                    div = cidMap[6][1];
                    cidMap[6][1] = 0;
                }
                 else if(change === cidMap[7][0] && div > cidMap[7][1]){
                    div = cidMap[7][1];
                    cidMap[7][1] = 0;
                    //temp = [change, div];//duplicated code
                }
                else if(change === cidMap[8][0] && div > cidMap[8][1]){
                    div = cidMap[8][1];
                    cidMap[8][1] = 0;
                }

                temp = [change, div];
                combine.push(temp);
                num = (num - div).toFixed(2);
                num = +num;
                display(num);
            }
        }

        return combine;
    }

      function total(cid){
        var cashAmts = [];
        cid.forEach(function(v){
            cashAmts.push(v[1]);
        },0);
            var sum = cashAmts.reduce(function(a, b){return a + b;
            }).toFixed(2);
            return +sum;
    }

            if(cash < price){
                return price;
            }
            else if(total(cid) < change){
                return "Insufficient Funds";
            }
            else if(total(cid) === change){
                return "Closed";
            }
            else if(total(cid) > change){
                return display(change, cid);
        }
}

console.log(drawer(3.26, 100.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]));

}());

但Facebook不会显示预览图片。 期待答案。

我的页面:https://splashyourcash.com

1 个答案:

答案 0 :(得分:0)

它有image loaded ok,但您在https端点上遇到重定向问题。改为:

<meta property="og:image" content="http://splashyourcash.com/images/safee.jpg"/>