【问题标题】:GoogleBot Mobile throwing errors on Rails siteGoogleBot Mobile 在 Rails 网站上抛出错误
【发布时间】:2012-01-09 09:28:19
【问题描述】:

一天中有几次,我收到页面格式不正确的错误。

ActionView::MissingTemplate: Missing template frontpage/index with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml, :slim, :haml], :formats=>["*/*;q=0.6"], :locale=>[:en_GB, :en_GB]} in view paths .....

错误环境:

> HTTP_ACCEPT    
> "*/*;q=0.6" 
> HTTP_ACCEPT_ENCODING   
> "gzip,deflate"
> HTTP_CONNECTION    
> "Keep-alive" HTTP_FROM     "googlebot(at)googlebot.com"
> HTTP_USER_AGENT    
> "SAMSUNG-SGH-E250/1.0 Profile/MIDP-2.0
> Configuration/CLDC-1.1 UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)"

每次似乎都是 GoogleBot Mobile 试图抓取该页面。

我们正在使用带有 Nginx/Passenger Web 服务器的 Rails 3.0.7。有没有什么移动爬虫相关的配置可以避免抛出这个错误?

【问题讨论】:

  • 您为 i18n 环境设置的语言环境是哪种方式?
  • config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '*', '.{rb,yml}' )] config.i18n.default_locale = :en_GB config.i18n.available_locales = [ :en_GB, :nb_NO ]

标签: ruby-on-rails google-crawlers


【解决方案1】:

这是一个已知问题: https://github.com/rails/rails/pull/4176

您可以使用控制器中的 respond_to 和 respond_with 方法修复它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-02-03
    • 2021-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-28
    相关资源
    最近更新 更多