Merge pull request #772 from zorun/master
Prevent indexing of old versions of a page (fixes #768)
This commit is contained in:
@@ -388,6 +388,7 @@ module Precious
|
|||||||
@page = page
|
@page = page
|
||||||
@name = name
|
@name = name
|
||||||
@content = page.formatted_data
|
@content = page.formatted_data
|
||||||
|
@version = version
|
||||||
mustache :page
|
mustache :page
|
||||||
else
|
else
|
||||||
halt 404
|
halt 404
|
||||||
|
|||||||
@@ -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/dialog.css" media="all">
|
||||||
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/template.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}}
|
{{#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]>
|
<!--[if IE 7]>
|
||||||
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/ie7.css" media="all">
|
<link rel="stylesheet" type="text/css" href="{{base_url}}/css/ie7.css" media="all">
|
||||||
|
|||||||
@@ -35,6 +35,10 @@ module Precious
|
|||||||
first.authored_date.strftime(DATE_FORMAT)
|
first.authored_date.strftime(DATE_FORMAT)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def noindex
|
||||||
|
@version ? true : false
|
||||||
|
end
|
||||||
|
|
||||||
def editable
|
def editable
|
||||||
@editable
|
@editable
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -523,6 +523,18 @@ context "Frontend" do
|
|||||||
assert_match /スイカ/, last_response.body
|
assert_match /スイカ/, last_response.body
|
||||||
end
|
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
|
def app
|
||||||
Precious::App
|
Precious::App
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user