Merge pull request #772 from zorun/master

Prevent indexing of old versions of a page (fixes #768)
This commit is contained in:
bootstraponline
2014-01-01 09:05:07 -08:00
4 changed files with 18 additions and 0 deletions
+1
View File
@@ -388,6 +388,7 @@ module Precious
@page = page
@name = name
@content = page.formatted_data
@version = version
mustache :page
else
halt 404
+1
View File
@@ -7,6 +7,7 @@
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/dialog.css" media="all">
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/template.css" media="all">
{{#css}}<link rel="stylesheet" type="text/css" href="{{base_url}}/custom.css" media="all">{{/css}}
{{#noindex}}<meta name="robots" content="noindex, nofollow" />{{/noindex}}
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/ie7.css" media="all">
+4
View File
@@ -35,6 +35,10 @@ module Precious
first.authored_date.strftime(DATE_FORMAT)
end
def noindex
@version ? true : false
end
def editable
@editable
end
+12
View File
@@ -523,6 +523,18 @@ context "Frontend" do
assert_match /スイカ/, last_response.body
end
test "add noindex tags to history pages" do
get "A"
assert last_response.ok?
assert_no_match /meta name="robots" content="noindex, nofollow"/, last_response.body
get "A/fc66539528eb96f21b2bbdbf557788fe8a1196ac"
assert last_response.ok?
assert_match /meta name="robots" content="noindex, nofollow"/, last_response.body
end
def app
Precious::App
end