FIX: crawler view of paginated content should have link elements in head for next and previous pages

This commit is contained in:
Neil Lalonde 2017-02-07 16:11:06 -05:00
parent df8f365d99
commit a5dfcddc6c
3 changed files with 22 additions and 0 deletions

View File

@ -49,6 +49,13 @@
<% end %>
<span itemprop='url'><b><a href='<%= @list.more_topics_url %>' rel='next' itemprop='name'><%= t 'next_page' %></a></b></span>
</div>
<% content_for :head do %>
<% if params[:page].to_i > 0 %>
<link rel="prev" href="<%= @list.prev_topics_url -%>">
<% end %>
<link rel="next" href="<%= @list.more_topics_url -%>">
<% end %>
<% end %>
<%- end %>

View File

@ -4,6 +4,12 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><%= @topic_view.topic.title %></title>
<%= raw crawlable_meta_data(title: @topic_view.title, description: @topic_view.summary, image: @topic_view.image_url, read_time: @topic_view.read_time, like_count: @topic_view.like_count) %>
<% if @topic_view.prev_page %>
<link rel="prev" href="<%= @topic_view.prev_page_path -%>">
<% end %>
<% if @topic_view.next_page %>
<link rel="next" href="<%= @topic_view.next_page_path -%>">
<% end %>
</head>
<body>
<% @topic_view.posts.each do |post| %>

View File

@ -80,6 +80,15 @@
<% content_for :head do %>
<%= auto_discovery_link_tag(@topic_view, {action: :feed, slug: @topic_view.topic.slug, topic_id: @topic_view.topic.id}, title: t('rss_posts_in_topic', topic: @topic_view.title), type: 'application/rss+xml') %>
<%= raw crawlable_meta_data(title: @topic_view.title, description: @topic_view.summary, image: @topic_view.image_url, read_time: @topic_view.read_time, like_count: @topic_view.like_count) %>
<% if @topic_view.prev_page || @topic_view.next_page %>
<% if @topic_view.prev_page %>
<link rel="prev" href="<%= @topic_view.prev_page_path -%>">
<% end %>
<% if @topic_view.next_page %>
<link rel="next" href="<%= @topic_view.next_page_path -%>">
<% end %>
<% end %>
<% end %>
<% content_for(:title) { "#{@topic_view.page_title}" } %>