views: set twitter:title, og:title on all pages.
This commit is contained in:
@@ -272,20 +272,18 @@ module ApplicationHelper
|
||||
def page_title(title = nil)
|
||||
if title.present?
|
||||
content_for(:page_title) { "#{title} | #{Danbooru.config.app_name}" }
|
||||
elsif title.blank? && !title.nil?
|
||||
content_for(:page_title) { Danbooru.config.app_name }
|
||||
elsif content_for(:page_title).present?
|
||||
content_for(:page_title)
|
||||
elsif params[:action] == "index"
|
||||
"#{params[:controller].titleize} - #{Danbooru.config.app_name}"
|
||||
"#{params[:controller].titleize} | #{Danbooru.config.app_name}"
|
||||
elsif params[:action] == "show"
|
||||
"#{params[:controller].singularize.titleize} - #{Danbooru.config.app_name}"
|
||||
"#{params[:controller].singularize.titleize} | #{Danbooru.config.app_name}"
|
||||
elsif params[:action] == "new"
|
||||
"New #{params[:controller].singularize.titleize} - #{Danbooru.config.app_name}"
|
||||
"New #{params[:controller].singularize.titleize} | #{Danbooru.config.app_name}"
|
||||
elsif params[:action] == "edit"
|
||||
"Edit #{params[:controller].singularize.titleize} - #{Danbooru.config.app_name}"
|
||||
"Edit #{params[:controller].singularize.titleize} | #{Danbooru.config.app_name}"
|
||||
elsif params[:action] == "search"
|
||||
"Search #{params[:controller].titleize} - #{Danbooru.config.app_name}"
|
||||
"Search #{params[:controller].titleize} | #{Danbooru.config.app_name}"
|
||||
else
|
||||
"#{Danbooru.config.app_name}/#{params[:controller]}"
|
||||
end
|
||||
|
||||
@@ -74,6 +74,8 @@
|
||||
|
||||
window.addthis_config = { ui_click: true };
|
||||
</script>
|
||||
<%= tag.meta name: "twitter:title", content: page_title %>
|
||||
<%= tag.meta name: "og:title", content: page_title %>
|
||||
<%= yield :html_header %>
|
||||
<%= raw Danbooru.config.custom_html_header_content %>
|
||||
</head>
|
||||
|
||||
@@ -1,15 +1,3 @@
|
||||
<% 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 %>
|
||||
<% "#{@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 %>
|
||||
<% end %>
|
||||
|
||||
<% if @post_set.hide_from_crawler? %>
|
||||
<meta name="robots" content="nofollow,noindex">
|
||||
<% end %>
|
||||
@@ -41,4 +29,4 @@
|
||||
<%= tag.meta name: "twitter:image", content: @post_set.best_post.open_graph_image_url %>
|
||||
<%= tag.meta name: "og:image", content: @post_set.best_post.open_graph_image_url %>
|
||||
<%= tag.meta name: "twitter:card", content: "summary_large_image" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -159,7 +159,6 @@
|
||||
<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? %>">
|
||||
<%= tag.meta name: "og:title", content: "#{@post.presenter.humanized_essential_tag_string} - #{Danbooru.config.app_name}" %>
|
||||
|
||||
<% if @post.visible? %>
|
||||
<%= tag.meta name: "og:image", content: @post.open_graph_image_url %>
|
||||
@@ -175,7 +174,6 @@
|
||||
<% if @post.twitter_card_supported? %>
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<%= 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? %>
|
||||
|
||||
Reference in New Issue
Block a user