在网站上启动Google Crawler时遇到此错误:
错误消息:
关于SO的研究:
我注意到了以下三个相关问题:
ActionView::MissingTemplate->我没有使用HAML
ActionView::MissingTemplate: Missing template->不相关
Googlebot receiving missing template error for an existing template->尝试 gem “rails_fix_google_bot_accept”没有区别。
更多详细信息:
Errbit指出可能的错误:
88.4%
7.4%
2.5%
1.7%
完整追溯:
https://gist.github.com/YOUConsulting/a59e134a98b4d5bc1438
HTTP_ACCEPT:
图像/*
HTTP_USER_AGENT:
Mozilla/5.0(Windows NT 6.1; rv:6.0)Gecko/20110814 Firefox/6.0 Google favicon
参数:
{
“action” =>“index”,
“ Controller ” =>“家”
}
更新1:添加了HomeController索引
def index
@interest_groups = InterestGroup.all.sort_by &:position || [] # Category blocks
@special_interest_groups = SpecialInterestGroup.all || [] # Student block(s)
@hot_jobs = HotJob.all(api_params_for_user) || [] # Hot Jobs
@jobs_for_you = Job.jobs_for_you(api_params_for_user) || [] # Jobs for you
@applications = []
if current_user
@applications = Application.all_for_user_with_token(current_user.token).select{|a| a.visible?} # Applications
@user = current_user
@user.fetch_sap_data!
end
if params[:status] && params[:status] == '404'
@errors = I18n.t("home.errors.error_404")
@errors_long = I18n.t("home.errors.error_404_long")
@errors_extra = I18n.t("home.errors.error_404_extra")
elsif params[:status] && params[:status] == '422'
@errors = I18n.t("home.errors.error_422")
elsif params[:status] && params[:status] == '500'
@errors = I18n.t("home.errors.error_500")
end
end
最佳答案
找到了答案:
漫游器正在触发页面www.example.com/status=500,该页面触发了我的HTTP 500错误。
我找到了一种更好的方式来实现我的错误页面,这解决了我的问题:
http://makandracards.com/makandra/12807-custom-error-pages-in-rails-3-2