Facebook共享插件无法正常工作,并在共享时显示错误页面

时间:2016-03-29 03:45:21

标签: meta-tags facebook-social-plugins

我的Facebook共享插件无法正常使用此页面底部https://www.tradesumo.com/Home/LearningsFromLaunchingAStartupWhileAtUniversity的博文帖子“喜欢我们的博文?与您的朋友分享!”当我尝试分享它时,它会加载我们的错误页面(你会看到很多大熊猫)而不是指定的图像和正确的标题和描述。

我不明白为什么这不起作用因为我们使用的代码非常类似于我用于https://www.tradesumo.com/Home/Blog的FB社交共享图标工作正常,并从元传播正确的东西该视图的标签。

仅供参考,以下是博客和博客文章分别为FB共享插件的元标记和代码:

BLOG:

@section AdditionalMeta
{
    <meta name="robots" content="noindex,nofollow"/>
    <meta property="og:type" content="website" />
    <meta property="og:title" content="TradeSumo | Blog" />
    <meta property="og:image" content="~/Scripts/Landing/assets/img/custom/meta.jpg" />
    <meta property="og:url" content="https://www.tradesumo.com/Home/Blog" />
    <meta property="og:description" content="Latest news, updates and events about TradeSumo." />   
}



<li><a href="https://www.facebook.com/sharer/sharer.php?u=https://www.tradesumo.com/Home/Blog&t=TradeSumo%20|%20Blog" title="Share on Facebook" target="_blank"><img src="~/Scripts/Landing/assets/img/flat_web_icon_set/color/Facebook.png"></a></li>

博客帖子:

@section AdditionalMeta
{
    <meta name="robots" content="noindex,nofollow"/>
    <meta property="og:type" content="website" />
    <meta property="og:title" content="TradeSumo | Learnings From Launching A Startup While At University" />
    <meta property="og:image" content="~/Scripts/Landing/assets/img/blog/startupweekend1.jpg" />
    <meta property="og:url" content="https://www.tradesumo.com/Home/LearningsFromLaunchingAStartupWhileAtUniversity" />
    <meta property="og:description" content="People always ask me what launching a tech startup while studying or working is like. It is definitely possible as long as you have a committed team with a united vision." />   
}



<li><a href="https://www.facebook.com/sharer/sharer.php?u=https://www.tradesumo.com/Home/LearningsFromLaunchingAStartupWhileAtUniversity&t=TradeSumo%20|%20Learnings%20From%20Launching%20A%20Startup%20While%20At%20University" title="Share on Facebook" target="_blank"><img src="~/Scripts/Landing/assets/img/flat_web_icon_set/color/Facebook.png"></a></li>

如果有人能告诉我为什么这是错误的话会很棒....我也尝试通过https://developers.facebook.com/tools/debug/og/object?q=https%3A%2F%2Fwww.tradesumo.com%2FHome%2FLearningsFromLaunchingAStartupWhileAtUniversity的URL调试插件但是不知道是什么问题!

1 个答案:

答案 0 :(得分:0)

我发现问题出在图像元标记上。它需要有完整的URL:

<meta property="og:image" content="https://www.tradesumo.com/Scripts/Landing/assets/img/blog/startupweekend1.jpg" />

而不是:

<meta property="og:image" content="~/Scripts/Landing/assets/img/blog/startupweekend1.jpg" />

插件无法找到图像并返回图像的错误页面。奇怪的是,我必须对图像元标记不同地对待博客和博客发布视图,因为我使用后一个元标记进行博客视图,它工作正常,博客和博客帖子视图都在同一个视图中家庭控制器,所以,他们应该以同样的方式工作。无论如何,问题已经解决了!