我的团队最近推出了一个大量使用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 =
我花了几个小时寻找解释......
最可能的罪魁祸首似乎是Facebook缓存,但它已经被怀疑很久了,因为这个网站是当前直播活动的一部分,强调喜欢活动,我希望有人知道一个技巧,尽快让这个工作.谢谢!
我有动作缓存工作在我的网站索引,并设置一个工作正常的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'.我只是想知道扫地机是否具备此功能(以保持我的控制器更清洁).