小编jhi*_*009的帖子

Facebook URL Linter为错误的页面提取数据

我的团队最近推出了一个大量使用Facebook的Like Button的Web应用程序.他们中的大多数工作正常,但Facebook或其URL Linter无法正确识别几个相似的URL.这些URL用于我们的应用程序中的页面,该页面重定向到Facebook应用程序中的相应页面...

示例网址:http://www.3mframeworks.com/pages/redirect? url = http% 3A%2F%2Fapps.facebook.com%2Fcouplespeak% 3Fv%3Dvideos%
26id%3D17

Facebook的URL Linter返回数据,好像"id"参数不存在:https://developers.facebook.com/tools/lint? url = http%3A %% 2F%2Fwww.3mframeworks.com%2Fpages%2Fredirect%3Furl
%3Dhttp%253A%252F%252Fapps.facebook.com%252Fcouplespeak%253Fv%253Dvideos%2526id%253D17

其他Open Graph解析器返回正确的数据:
og:it:http://ogit.heroku.com/inspect?url = www.3mframeworks.com%2Fpages%2Fredirect%3Furl%3Dhttp%253A%252F% 252Fapps.facebook.com %252Fcouplespeak%253Fv%253Dvideos%2526id%253D34
OpenGraph.In:http://www.opengraph.in/?url=www.3mframeworks.com%2Fpages%2Fredirect%3Furl%3Dhttp%253A%252F%252Fapps.facebook.com %252Fcouplespeak%253Fv%253Dvideos%2526id%253D34&格式HTML =

我花了几个小时寻找解释......

  1. Facebook编辑Meta标签下的文档指出:
    • "请注意,og:title和og:type最初只能编辑 - 在你的页面收到50个赞之后标题变得固定,并且在你的页面收到10,000个喜欢之后,类型就变得固定了." 我的数量远不及这些数字.
    • "为了在Facebook上反映更改,您必须强制删除页面.当页面管理员单击"赞"按钮或将URL输入Facebook URL Linter时,页面将被删除.您可以通过编程强制执行curL'ing the linter要刮掉的页面." 我已经尝试了所有这三种方法但没有成功.
  2. Facebook Like按钮 - 提取"错误"图像表明,如Facebook所声称的那样,linting URL不会重置缓存.
  3. Facebook Open Graph没有清除缓存表明这可能是Facebook缓存,它将在一段未知的时间后自行修复.
  4. Facebook喜欢按钮喜欢错误的网址建议等待24-32小时Facebook的缓存重置.自我的Open Graph标签上次设置以来已经超过64小时了.
  5. 为什么Facebook返回错误页面(影响Facebook赞和分享URL)?建议在发布之前提供给Facebook的任何URL(例如通过Like Button)都应该更改.我尝试更改URL,重命名id参数,但没有成功.

最可能的罪魁祸首似乎是Facebook缓存,但它已经被怀疑很久了,因为这个网站是当前直播活动的一部分,强调喜欢活动,我希望有人知道一个技巧,尽快让这个工作.谢谢!

facebook facebook-like facebook-graph-api

4
推荐指数
1
解决办法
2809
查看次数

Rails扫地机可以在不同的控制器上工作吗?

我有动作缓存工作在我的网站索引,并设置一个工作正常的SiteSweeper:

# app/controllers/admin/sites_controller.rb
class Admin::SitesController < Admin::BaseController
  cache_sweeper :site_sweeper, :only => [:create, :update, :destroy]
  caches_action :index, :cache_path => '/admin/sites'
  ...

# app/sweepers/site_sweeper.rb
class SiteSweeper < ActionController::Caching::Sweeper
  observe Site

  def after_save(site)
    expire_cache(site)
  end

  def after_destroy(site)
    expire_cache(site)
  end

  def expire_cache(site)
    expire_action '/admin/sites'
  end
end
Run Code Online (Sandbox Code Playgroud)

但是,无论何时保存或销毁任何发布者,我也希望过期/管理/站点.是否有可能让PublisherSweeper使用这样的东西使网站索引到期?

# app/sweepers/publisher_sweeper.rb
class PublisherSweeper < ActionController::Caching::Sweeper
  observe Publisher

  def after_save(publisher)
    expire_cache(publisher)
  end

  def after_destroy(publisher)
    expire_cache(publisher)
  end

  def expire_cache(publisher)
    expire_action '/admin/sites'
  end
end
Run Code Online (Sandbox Code Playgroud)

我知道我可以在各种Publisher动作中调用expire_action'/ admin/sites'.我只是想知道扫地机是否具备此功能(以保持我的控制器更清洁).

caching ruby-on-rails sweeper

2
推荐指数
1
解决办法
1694
查看次数