Reputation: 2513
I noticed a problem with indexing my rails app when submitting it to Google webmaster tools and testing with curl.
My root is currently set like so:
map.root :controller => "posts"
which will explain when i run:
$ curl http://0.0.0.0:3000
it only returns the posts controller and not the homepage in its entirety:
<div class="post" id="post_25">
<h2><a href="/posts/25">test</a><span class="date">09<br><b>Jul</b></span></h2>
<p><p>Aliquam erat volutpat. Mauris vel neque sit amet nunc gravida congue sed sit amet purus. Quisque lacus quam, egestas ac tincidunt a, lacinia vel velit. Aenean facilisis nulla vitae urna.</p></p>
<h3 class="more"><a href="/posts/25">Read Post</a></h3>
<p class="comment_count">
<a href="/posts/25">
1 comment
</a>
</p>
Because of this I had to add my Google verification meta code into the posts view to get it to verify confirming my fears that when Google crawls my site all it is seeing is the posts controller.
How do I make it return the entire homepage and not just the post controller?
Upvotes: 3
Views: 604
Reputation: 6840
Looks like you are somehow sending an RSS/Atom feed when the page is requested by certain user agents. Check out the content type header in this verbose curl call:
$ curl -v http://alexefish.com/
* About to connect() to alexefish.com port 80 (#0)
* Trying 174.129.212.2... connected
* Connected to alexefish.com (174.129.212.2) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.16.4 (i386-apple-darwin9.0) libcurl/7.16.4 OpenSSL/0.9.7l zlib/1.2.3
> Host: alexefish.com
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx/0.6.39
< Date: Mon, 12 Jul 2010 15:50:58 GMT
< Content-Type: application/atom+xml; charset=utf-8
< Connection: keep-alive
< ETag: "85c19351dbfb19431738e7b6f360025a"
< X-Runtime: 37ms
< Cache-Control: private, max-age=0, must-revalidate
< Set-Cookie: _Blog_session=BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D--fd6fef239709f99c7b2d7e2d353b22f1749fd3a1; path=/; HttpOnly
< Content-Length: 2442
< X-Varnish: 975219293
< Age: 0
< Via: 1.1 varnish
<
Perhaps you have some middleware or other application code doing this?
Upvotes: 2
Reputation: 115372
You can define an application layout by creating app/views/layouts/application.html.erb
. This will be used by all responses unless you specify otherwise. See this Rails Guide on Layouts and Rendering for more details.
Upvotes: 0