Fix #2061: <Link> elements for pools.

Add <link rel="prev"> and <link rel="next"> tags to the forum topic show
page, the pool show page, and the favgroup show page.

This is kind of useless now since Google hasn't used these tags for SEO
for years ([1]), and userscripts can use `#paginator-next` and
`#paginator-prev` to find the next/prev pages, but whatever.

[1]: https://yoast.com/google-doesnt-use-rel-prev-next-for-pagination
This commit is contained in:
evazion
2020-04-30 19:57:06 -05:00
parent 3d3f9ce46c
commit 8299c969fb
5 changed files with 15 additions and 8 deletions

View File

@@ -0,0 +1,11 @@
<%# collection %>
<% content_for(:html_header) do %>
<% if collection.try(:prev_page) %>
<%= tag.link rel: "prev", href: url_for(nav_params_for(collection.prev_page)) %>
<% end %>
<% if collection.try(:next_page) %>
<%= tag.link rel: "next", href: url_for(nav_params_for(collection.next_page)) %>
<% end %>
<% end %>

View File

@@ -1,4 +1,5 @@
<% page_title "Favgroup: #{@favorite_group.pretty_name}" %>
<%= render "meta_links", collection: @posts %>
<%= render "secondary_links" %>
<div id="c-favorite-groups">

View File

@@ -2,6 +2,7 @@
<% meta_description(DText.excerpt(@forum_topic.original_post&.body)) %>
<% atom_feed_tag(@forum_topic.title, forum_topic_url(@forum_topic.id, format: :atom)) %>
<%= render "meta_links", collection: @forum_posts %>
<%= render "secondary_links" %>
<div id="c-forum-topics">

View File

@@ -4,14 +4,7 @@
<title><%= page_title %></title>
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<% if @current_item.try(:prev_page) %>
<%= tag.link rel: "prev", href: url_for(nav_params_for(@current_item.prev_page)) %>
<% end %>
<% if @current_item.try(:next_page) %>
<%= tag.link rel: "next", href: url_for(nav_params_for(@current_item.next_page)) %>
<% end %>
<%= render "meta_links", collection: @current_item %>
<%= csrf_meta_tag %>
<% unless CurrentUser.enable_desktop_mode? %>

View File

@@ -1,6 +1,7 @@
<% page_title @pool.pretty_name %>
<% meta_description("#{number_with_delimiter(@pool.post_count)} posts. #{DText.excerpt(@pool.description)}") %>
<%= render "meta_links", collection: @posts %>
<%= render "secondary_links" %>
<div id="c-pools">