ソースを参照

Allow doc index pages to be indexed and tweak meta descriptions

Thibaut 11 年 前
コミット
76c619680e
4 ファイル変更7 行追加5 行削除
  1. 4 0
      lib/app.rb
  2. 0 2
      public/robots.txt
  3. 2 2
      views/index.erb
  4. 1 1
      views/other.erb

+ 4 - 0
lib/app.rb

@@ -98,6 +98,10 @@ class App < Sinatra::Application
         result
       end
     end
+
+    def doc_index_page?
+      @doc && request.path == "/#{@doc['slug']}/"
+    end
   end
 
   before do

+ 0 - 2
public/robots.txt

@@ -3,5 +3,3 @@ Disallow: /about
 Disallow: /news
 Disallow: /tips
 Disallow: /help
-Disallow: /*/
-Allow: /

+ 2 - 2
views/index.erb

@@ -3,9 +3,9 @@
 <head>
   <meta charset="utf-8">
   <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">
-  <meta name="description" content="DevDocs combines multiple API documentations in a fast, organized, and searchable interface.">
+  <meta name="description" content="DevDocs combines multiple reference documentations in a fast, organized, and searchable interface: HTML, CSS, JavaScript, PHP, Ruby, Python, Go, C, C++, etc.">
   <meta property="og:title" content="DevDocs">
-  <meta property="og:description" content="DevDocs combines multiple API documentations in a fast, organized, and searchable interface.">
+  <meta property="og:description" content="DevDocs combines multiple reference documentations in a fast, organized, and searchable interface: HTML, CSS, JavaScript, PHP, Ruby, Python, Go, C, C++, etc.">
   <meta property="og:type" content="website">
   <meta property="og:url" content="http://devdocs.io">
   <meta property="og:image" content="http://maxcdn.devdocs.io/images/icon-128.png">

+ 1 - 1
views/other.erb

@@ -3,7 +3,7 @@
 <head>
   <meta charset="utf-8">
   <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">
-  <meta name="robots" content="noindex">
+  <% if doc_index_page? %><meta name="description" content="<%= @doc['name'] %> reference documentation with fast, fuzzy search, keyboard shortcuts, mobile version, and more."><% else %><meta name="robots" content="noindex"><% end %>
   <meta name="format-detection" content="telephone=no">
   <title>DevDocs</title>
   <link rel="icon" type="image/x-icon" href="http://maxcdn.devdocs.io/favicon.ico">