add additional meta tags for seo
This commit is contained in:
@@ -65,22 +65,12 @@
|
||||
<% end %>
|
||||
|
||||
<%= content_for(:html_header) do %>
|
||||
<link href="<%= posts_path(:format => 'atom', :tags => params[:tags]) %>" rel="alternate" title="ATOM" type="application/atom+xml" />
|
||||
<%#= tag.link rel: "prefetch", href: next_page_url, as: "html", crossorigin: "use-credentials" %>
|
||||
<%= tag.link href: posts_path(format: "atom", tags: params[:tags]), rel: "alternate", title: "ATOM", type: "application/atom+xml" %>
|
||||
<%= tag.link rel: "prefetch", href: next_page_url, as: "html", crossorigin: "use-credentials" %>
|
||||
<%= tag.link rel: "next", href: next_page_url %>
|
||||
<% if prev_page_url %>
|
||||
<%= tag.link rel: "prev", href: prev_page_url %>
|
||||
<% end %>
|
||||
<% if @post_set.has_wiki? %>
|
||||
<meta name="description" content="<%= strip_dtext(@post_set.wiki_page.presenter.excerpt) %>">
|
||||
<% else %>
|
||||
<meta name="description" content="<%= Danbooru.config.description %>">
|
||||
<% end %>
|
||||
<%= missed_post_search_count_js %>
|
||||
<% if @post_set.hide_from_crawler? %>
|
||||
<meta name="robots" content="nofollow,noindex">
|
||||
<% end %>
|
||||
<% if @post_set.has_explicit? %>
|
||||
<meta name="rating" content="adult">
|
||||
<% end %>
|
||||
<%= render "posts/partials/index/seo_meta_tags" %>
|
||||
<% end %>
|
||||
|
||||
49
app/views/posts/partials/index/_seo_meta_tags.html.erb
Normal file
49
app/views/posts/partials/index/_seo_meta_tags.html.erb
Normal file
@@ -0,0 +1,49 @@
|
||||
<% if @post_set.has_wiki? %>
|
||||
<% strip_dtext(@post_set.wiki_page.presenter.excerpt).tap do |title| %>
|
||||
<%= tag.meta name: "og:title", content: title %>
|
||||
<%= tag.meta name: "twitter:title", content: title %>
|
||||
<% end %>
|
||||
<% elsif @post_set.tag_string.present? %>
|
||||
<% "#{@post_set.humanized_tag_string} - #{Danbooru.config.app_name}".tap do |title| %>
|
||||
<%= tag.meta name: "og:title", content: title %>
|
||||
<%= tag.meta name: "twitter:title", content: title %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% Danbooru.config.description.tap do |title| %>
|
||||
<%= tag.meta name: "og:title", content: title %>
|
||||
<%= tag.meta name: "twitter:title", content: title %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if @post_set.hide_from_crawler? %>
|
||||
<meta name="robots" content="nofollow,noindex">
|
||||
<% end %>
|
||||
|
||||
<% if @post_set.has_explicit? %>
|
||||
<meta name="rating" content="adult">
|
||||
<% end %>
|
||||
|
||||
<%= tag.meta name: "canonical", content: posts_url(tags: params[:tags], host: Danbooru.config.domain) %>
|
||||
|
||||
<% if params[:tags].present? %>
|
||||
<% "Find the best art of #{params[:tags].tr('_', ' ').titleize} on #{Danbooru.config.app_name}".tap do |desc| %>
|
||||
<%= tag.meta name: "description", content: desc %>
|
||||
<%= tag.meta name: "og:description", content: desc %>
|
||||
<%= tag.meta name: "twitter:description", content: desc %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% Danbooru.config.description.tap do |desc| %>
|
||||
<%= tag.meta name: "description", content: desc %>
|
||||
<%= tag.meta name: "og:description", content: desc %>
|
||||
<%= tag.meta name: "twitter:description", content: desc %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= tag.meta name: "og:type", content: "website" %>
|
||||
<%= tag.meta name: "og:site", content: Danbooru.config.app_name %>
|
||||
|
||||
<% if @post_set.best_post.present? %>
|
||||
<%= tag.meta name: "twitter:image", content: @post_set.best_post.file_url %>
|
||||
<%= tag.meta name: "og:image", content: @post_set.best_post.file_url %>
|
||||
<%= tag.meta name: "twitter:card", content: "summary_large_image" %>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user