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 %>

View File

@@ -156,14 +156,14 @@
<% end %>
<% content_for(:html_header) do %>
<meta name="description" content="<%= @post.presenter.humanized_tag_string %>">
<%= tag.meta name: "description", content: "View this #{@post.image_width}x#{@post.image_height} #{number_to_human_size(@post.file_size)} image" %>
<meta name="post-id" content="<%= @post.id %>">
<meta name="post-has-embedded-notes" content="<%= @post.has_embedded_notes? %>">
<meta name="always-resize-images" content="<%= CurrentUser.user.always_resize_images? %>">
<meta property="og:title" content="<%= @post.presenter.humanized_essential_tag_string %> - <%= Danbooru.config.app_name %>">
<%= tag.meta name: "og:title", content: "#{@post.presenter.humanized_essential_tag_string} - #{Danbooru.config.app_name}" %>
<% if @post.visible? %>
<meta property="og:image" content="<%= @post.open_graph_image_url %>">
<%= tag.meta name: "og:image", content: @post.open_graph_image_url %>
<% end %>
<% if Danbooru.config.enable_post_search_counts %>
@@ -175,12 +175,12 @@
<%# Twitter properties %>
<% if @post.twitter_card_supported? %>
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="<%= Danbooru.config.twitter_site %>">
<meta name="twitter:title" content="<%= @post.presenter.humanized_essential_tag_string %> - <%= Danbooru.config.app_name %>">
<meta name="twitter:description" content="<%= @post.presenter.humanized_tag_string %> - <%= Danbooru.config.app_name %>">
<%= tag.meta name: "twitter:site", content: Danbooru.config.twitter_site %>
<%= tag.meta name: "twitter:title", content: "#{@post.presenter.humanized_essential_tag_string} - #{Danbooru.config.app_name}" %>
<%= tag.meta name: "twitter:description", content: "View this #{@post.image_width}x#{@post.image_height} #{number_to_human_size(@post.file_size)} image" %>
<% if @post.visible? %>
<meta name="twitter:image" content="<%= @post.open_graph_image_url %>">
<%= tag.meta name: "twitter:image", content: @post.open_graph_image_url %>
<% end %>
<% end %>