Googlebot 收到现有模板缺少模板错误 [英] Googlebot receiving missing template error for an existing template
问题描述
在过去的几天里,当谷歌机器人尝试访问我们的主页(欢迎/索引)时,我们开始收到模板丢失错误.我一直盯着这个几个小时,知道我只是错过了一些简单的东西.
In the last couple of days, we have started to receive a missing template error when the google bot attempts to access our main home page (welcome/index). I have been staring at this for a couple of hours and know that I am just missing something simple.
A ActionView::MissingTemplate occurred in welcome#index:
Missing template welcome/index with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml, :haml], :formats=>["*/*;q=0.9"], :locale=>[:en, :en]}
但是模板确实存在(index.html.haml).如果没有,没有人可以访问我们的主页.
But the template does exist (index.html.haml). If it didn't no one could access our home page.
以下是一些额外的环境信息:
Here is some additional environment information:
* REMOTE_ADDR : 66.249.72.139
* REMOTE_PORT : 56883
* REQUEST_METHOD : GET
* REQUEST_URI : /
* Parameters: {"controller"=>"welcome", "action"=>"index"}
您的任何见解将不胜感激.
Any insights you have would be greatly appreciated.
推荐答案
问题的解决方案是在您的操作中指定格式.
The solution to the problem is to specify the format in your action.
到目前为止,我的索引操作中只有以下内容
Up until now, I had simply had the following in my index action
def index
end
一旦我插入了 response_to 块
Once I inserted a respond_to block
def index
respond_to do |format|
format.html
end
end
我不再收到丢失的模板错误.
I stopped getting the missing template errors.
这篇关于Googlebot 收到现有模板缺少模板错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!