Search code examples
ruby-on-railsgooglebotmissing-template

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]}

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.


Solution

  • 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
    

    Once I inserted a respond_to block

    def index
      respond_to do |format|
        format.html
      end
    end
    

    I stopped getting the missing template errors.