add rel meta links for prev and next page
This commit is contained in:
@@ -1,4 +1,22 @@
|
|||||||
module PostsHelper
|
module PostsHelper
|
||||||
|
def next_page_url
|
||||||
|
current_page = (params[:page] || 1).to_i
|
||||||
|
dup_params = params.dup
|
||||||
|
dup_params[:page] = current_page + 1
|
||||||
|
url_for(dup_params).html_safe
|
||||||
|
end
|
||||||
|
|
||||||
|
def prev_page_url
|
||||||
|
current_page = (params[:page] || 1).to_i
|
||||||
|
if current_page >= 2
|
||||||
|
dup_params = params.dup
|
||||||
|
dup_params[:page] = current_page - 1
|
||||||
|
url_for(dup_params).html_safe
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def missed_post_search_count_js
|
def missed_post_search_count_js
|
||||||
return nil unless Danbooru.config.enable_post_search_counts
|
return nil unless Danbooru.config.enable_post_search_counts
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,11 @@
|
|||||||
|
|
||||||
<%= content_for(:html_header) do %>
|
<%= content_for(:html_header) do %>
|
||||||
<link href="<%= posts_path(:format => 'atom', :tags => params[:tags]) %>" rel="alternate" title="ATOM" type="application/atom+xml" />
|
<link href="<%= posts_path(:format => 'atom', :tags => params[:tags]) %>" rel="alternate" title="ATOM" type="application/atom+xml" />
|
||||||
<%= content_tag(:link, nil, rel: "prefetch", href: posts_path(tags: params[:tags], page: (params[:page] || 1).to_i + 1), as: "html", crossorigin: "use-credentials") %>
|
<%= content_tag(:link, nil, rel: "prefetch", href: next_page_url, as: "html", crossorigin: "use-credentials") %>
|
||||||
|
<%= content_tag :link, nil, rel: "next", href: next_page_url %>
|
||||||
|
<% if prev_page_url %>
|
||||||
|
<%= content_tag :link, nil, rel: "prev", href: prev_page_url %>
|
||||||
|
<% end %>
|
||||||
<% if @post_set.has_wiki? %>
|
<% if @post_set.has_wiki? %>
|
||||||
<meta name="description" content="<%= @post_set.wiki_page.presenter.blurb %>">
|
<meta name="description" content="<%= @post_set.wiki_page.presenter.blurb %>">
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|||||||
Reference in New Issue
Block a user