From 547e174aa4b72e3dcb91aa114fdd56fee134eb23 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Wed, 14 Jun 2017 12:25:11 -0700 Subject: [PATCH] Add NOINDEX, FOLLOW to site profiles Search engines are ranking profiles above the actual site, so we're going to tell search engines not to index them. --- app/site.rb | 2 ++ app_helpers.rb | 9 +++++++++ views/layout.erb | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/app/site.rb b/app/site.rb index 648143cf..244384d6 100644 --- a/app/site.rb +++ b/app/site.rb @@ -30,6 +30,8 @@ get '/site/:username/?' do |username| @pagination_dataset = events_dataset @latest_events = events_dataset.all + meta_robots 'noindex, follow' + erb :'site', locals: {site: site, is_current_site: site == current_site} end diff --git a/app_helpers.rb b/app_helpers.rb index eb03284d..ea7b0b7c 100644 --- a/app_helpers.rb +++ b/app_helpers.rb @@ -58,6 +58,15 @@ def enforce_ban redirect '/' end +def meta_robots(newtag=nil) + if newtag + @_meta_robots = newtag + end + + @_meta_robots + tag = newtag || @_meta_robots +end + def title out = "Neocities" return out if request.path == '/' diff --git a/views/layout.erb b/views/layout.erb index a367acc4..4979c01c 100644 --- a/views/layout.erb +++ b/views/layout.erb @@ -15,6 +15,10 @@ + <% if meta_robots %> + + <% end %> +