update meta tags

This commit is contained in:
Albert Yi
2018-10-23 11:24:43 -07:00
parent 261cc8d993
commit 38d94a7d37
2 changed files with 12 additions and 18 deletions

View File

@@ -1,10 +1,10 @@
<% if @post_set.tag_string.present? %>
<% "#{@post_set.humanized_tag_string} - #{Danbooru.config.app_name}".tap do |title| %>
<% if @post_set.is_single_tag? %>
<% "#{@post_set.humanized_tag_string.titleize} - #{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| %>
<% "#{@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 %>
@@ -20,14 +20,8 @@
<%= tag.meta name: "canonical", content: posts_url(tags: params[:tags], host: Danbooru.config.hostname, protocol: "https") %>
<% if @post_set.has_wiki_text? %>
<% strip_dtext(truncate(@post_set.wiki_page.presenter.excerpt, length: 350)).tap do |desc| %>
<%= tag.meta name: "description", content: desc %>
<%= tag.meta name: "og:description", content: desc %>
<%= tag.meta name: "twitter:description", content: desc %>
<% end %>
<% elsif @post_set.is_single_tag? %>
<% "Find the best art of #{params[:tags].tr('_', ' ').titleize} on #{Danbooru.config.app_name}".tap do |desc| %>
<% if @post_set.is_single_tag? %>
<% "Find #{@post_set.post_count} images of #{@post_set.humanized_tag_string.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 %>