From bf022e858a006cd8e30ed3fdd72b420d10992da3 Mon Sep 17 00:00:00 2001 From: evazion Date: Thu, 9 Dec 2021 23:47:52 -0600 Subject: [PATCH] seo: prevent crawlers from crawling /posts/:id/favorites. --- .../post_votes_component/post_votes_component.html.erb | 2 +- app/views/favorites/index.html.erb | 2 ++ app/views/post_votes/index.html.erb | 2 ++ app/views/posts/partials/show/_information.html.erb | 2 +- app/views/robots/index.text.erb | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/components/post_votes_component/post_votes_component.html.erb b/app/components/post_votes_component/post_votes_component.html.erb index 89b84247d..76fafdc90 100644 --- a/app/components/post_votes_component/post_votes_component.html.erb +++ b/app/components/post_votes_component/post_votes_component.html.erb @@ -8,7 +8,7 @@ <% end %> - <%= link_to post.score, post_votes_path(search: { post_id: post.id }, variant: :compact) %> + <%= link_to post.score, post_votes_path(search: { post_id: post.id }, variant: :compact), rel: "nofollow" %> <% if current_user.is_anonymous? %> diff --git a/app/views/favorites/index.html.erb b/app/views/favorites/index.html.erb index d25e903b4..b460f2ec1 100644 --- a/app/views/favorites/index.html.erb +++ b/app/views/favorites/index.html.erb @@ -1,3 +1,5 @@ +<% noindex %> +
<% if @post %> diff --git a/app/views/post_votes/index.html.erb b/app/views/post_votes/index.html.erb index b7e900044..6052d98fe 100644 --- a/app/views/post_votes/index.html.erb +++ b/app/views/post_votes/index.html.erb @@ -1,3 +1,5 @@ +<% noindex %> +
<%= render "search" %> diff --git a/app/views/posts/partials/show/_information.html.erb b/app/views/posts/partials/show/_information.html.erb index 91f1c4e60..c8aeacac4 100644 --- a/app/views/posts/partials/show/_information.html.erb +++ b/app/views/posts/partials/show/_information.html.erb @@ -26,7 +26,7 @@
  • Favorites: <%= tag.span class: "post-favcount", "data-id": post.id do %> - <%= link_to post.fav_count, post_favorites_path(post) %> + <%= link_to post.fav_count, post_favorites_path(post), rel: "nofollow" %> <% end %>
  • diff --git a/app/views/robots/index.text.erb b/app/views/robots/index.text.erb index 859841bc9..c5c47f58e 100644 --- a/app/views/robots/index.text.erb +++ b/app/views/robots/index.text.erb @@ -8,6 +8,7 @@ Disallow: /*.json Disallow: /posts?tags=source:* Disallow: /posts?tags=ordfav:* Disallow: /posts?tags=approver:* +Disallow: /posts/*/favorites Disallow: <%= artist_urls_path %> Disallow: <%= artist_versions_path %>