Skip to content

Commit 5c48346

Browse files
committed
Build methods to sanitize and compile robot indexing information
1 parent 60baa50 commit 5c48346

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

lib/cortex/snippets/client/helper.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def seo_keywords
2626
end
2727

2828
def seo_robots
29-
webpage[:seo_robots]
29+
build_robot_information
3030
end
3131

3232
def noindex
@@ -58,6 +58,21 @@ def noimageindex
5858
def webpage
5959
Cortex::Snippets::Client::current_webpage(request)
6060
end
61+
62+
def build_robot_information
63+
robot_information = []
64+
index_options = [:noindex, :nofollow, :noodp, :nosnippet, :noarchive, :noimageindex]
65+
66+
index_options.each do |index_option|
67+
robot_information << index_option if valid_index_option?(index_option)
68+
end
69+
70+
robot_information.join(", ")
71+
end
72+
73+
def valid_index_option?(index_option)
74+
webpage[index_option]
75+
end
6176
end
6277
end
6378
end

0 commit comments

Comments
 (0)