From ee3b8933d2571d98f932c0efce30381d3c8858c3 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Sat, 20 Oct 2018 19:24:29 -0700 Subject: [PATCH] tweak social links --- app/javascript/src/javascripts/posts.js.erb | 8 ------- .../partials/index/_seo_meta_tags.html.erb | 6 ++--- .../posts/partials/index/_share.html.erb | 22 ++++++++++++++----- app/views/posts/partials/show/_share.html.erb | 11 ++++++---- app/views/posts/show.html.erb | 5 +++++ 5 files changed, 31 insertions(+), 21 deletions(-) diff --git a/app/javascript/src/javascripts/posts.js.erb b/app/javascript/src/javascripts/posts.js.erb index 795c23e87..6c8a20de3 100644 --- a/app/javascript/src/javascripts/posts.js.erb +++ b/app/javascript/src/javascripts/posts.js.erb @@ -1,5 +1,3 @@ -/* global addthis */ - import Utility from './utility' import Hammer from 'hammerjs' import RelatedTag from './related_tag.js.erb' @@ -99,7 +97,6 @@ Post.open_edit_dialog = function() { $("#edit").show(); $("#comments").hide(); - $("#share").hide(); $("#post-sections li").removeClass("active"); $("#post-edit-link").parent("li").addClass("active"); $("#related-tags-container").show(); @@ -432,12 +429,10 @@ Post.initialize_post_sections = function() { if (e.target.hash === "#comments") { $("#comments").show(); $("#edit").hide(); - $("#share").hide(); $("#recommended").hide(); } else if (e.target.hash === "#edit") { $("#edit").show(); $("#comments").hide(); - $("#share").hide(); $("#post_tag_string").focus().selectEnd().height($("#post_tag_string")[0].scrollHeight); $("#related-tags-button").trigger("click"); $("#fetch-data-manual").trigger("click"); @@ -445,7 +440,6 @@ Post.initialize_post_sections = function() { } else if (e.target.hash === "#recommended") { $("#comments").hide(); $("#edit").hide(); - $("#share").hide(); $("#recommended").show(); $.get("/recommended_posts", {context: "post", post_id: Utility.meta("post-id")}, function(data) { $("#recommended").html(data); @@ -453,8 +447,6 @@ Post.initialize_post_sections = function() { } else { $("#edit").hide(); $("#comments").hide(); - $("#share").show(); - addthis.init(); $("#recommended").hide(); } diff --git a/app/views/posts/partials/index/_seo_meta_tags.html.erb b/app/views/posts/partials/index/_seo_meta_tags.html.erb index ef03593cb..4e7f20e6d 100644 --- a/app/views/posts/partials/index/_seo_meta_tags.html.erb +++ b/app/views/posts/partials/index/_seo_meta_tags.html.erb @@ -23,7 +23,7 @@ <% end %> -<%= tag.meta name: "canonical", content: posts_url(tags: params[:tags], host: Danbooru.config.domain) %> +<%= tag.meta name: "canonical", content: posts_url(tags: params[:tags], host: Danbooru.config.hostname, protocol: "https") %> <% if params[:tags].present? %> <% "Find the best art of #{params[:tags].tr('_', ' ').titleize} on #{Danbooru.config.app_name}".tap do |desc| %> @@ -43,7 +43,7 @@ <%= 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: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 %> \ No newline at end of file diff --git a/app/views/posts/partials/index/_share.html.erb b/app/views/posts/partials/index/_share.html.erb index 96cf02d88..c8bad8ace 100644 --- a/app/views/posts/partials/index/_share.html.erb +++ b/app/views/posts/partials/index/_share.html.erb @@ -7,13 +7,23 @@ - + <% end %> diff --git a/app/views/posts/partials/show/_share.html.erb b/app/views/posts/partials/show/_share.html.erb index 6be5b3d6a..a38e76f63 100644 --- a/app/views/posts/partials/show/_share.html.erb +++ b/app/views/posts/partials/show/_share.html.erb @@ -7,13 +7,16 @@ - + <% end %> diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb index 5e4189fcd..35c6362f7 100644 --- a/app/views/posts/show.html.erb +++ b/app/views/posts/show.html.erb @@ -170,6 +170,8 @@ <% end %> + <%= tag.meta name: "canonical", content: post_url(@post, host: Danbooru.config.hostname, protocol: "https") %> + <%# Twitter properties %> <% if @post.twitter_card_supported? %> @@ -186,6 +188,9 @@ <% end %> + <%= tag.meta name: "og:type", content: "website" %> + <%= tag.meta name: "og:site", content: Danbooru.config.app_name %> + <%= auto_discovery_link_tag(:atom, comments_url(:atom, search: { post_id: @post.id }), title: "Comments for post ##{@post.id}") %> <% end %>