diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ec98366fb4c..59d6d91e89e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -148,6 +148,8 @@ module ApplicationHelper opts[:image] = "#{uri.scheme}:#{opts[:image]}" elsif opts[:image].present? && opts[:image].start_with?("/uploads/") opts[:image] = "#{Discourse.base_url}#{opts[:image]}" + elsif SiteSetting.default_opengraph_image_url.present? + opts[:image] = SiteSetting.default_opengraph_image_url end # Add opengraph tags diff --git a/app/views/about/index.html.erb b/app/views/about/index.html.erb index 5f8bb079b86..e669e15596c 100644 --- a/app/views/about/index.html.erb +++ b/app/views/about/index.html.erb @@ -104,3 +104,7 @@
<% end %> + +<% content_for :head do %> + <%= raw crawlable_meta_data(title: SiteSetting.title, description: SiteSetting.site_description) %> +<% end %> diff --git a/app/views/categories/index.html.erb b/app/views/categories/index.html.erb index 2d2b32d3e59..f30438dd2f1 100644 --- a/app/views/categories/index.html.erb +++ b/app/views/categories/index.html.erb @@ -12,3 +12,7 @@ <% content_for :title do %><%= @title %><% end %> + +<% content_for :head do %> + <%= raw crawlable_meta_data(title: SiteSetting.title, description: SiteSetting.site_description) %> +<% end %> diff --git a/app/views/list/list.erb b/app/views/list/list.erb index a88fb49974b..9b1513915f5 100644 --- a/app/views/list/list.erb +++ b/app/views/list/list.erb @@ -65,6 +65,10 @@ <%= auto_discovery_link_tag(:rss, { action: :category_feed }, title: t('rss_topics_in_category', category: @category.name)) %> <%= raw crawlable_meta_data(title: @category.name, description: @category.description) %> <% end %> +<% else %> + <% content_for :head do %> + <%= raw crawlable_meta_data(title: SiteSetting.title, description: SiteSetting.site_description) %> + <% end %> <% end %> <% if @title %> diff --git a/app/views/static/show.html.erb b/app/views/static/show.html.erb index 0f84dbcaac0..7716a696451 100644 --- a/app/views/static/show.html.erb +++ b/app/views/static/show.html.erb @@ -23,4 +23,11 @@ <% if @title %> <% content_for :title do %><%= @title %><% end %> + <% content_for :head do %> + <%= raw crawlable_meta_data(title: @title, description: SiteSetting.site_description) %> + <% end %> +<% else %> + <% content_for :head do %> + <%= raw crawlable_meta_data(title: SiteSetting.title, description: SiteSetting.site_description) %> + <% end %> <% end %> diff --git a/lib/topic_view.rb b/lib/topic_view.rb index 74637fa3ea1..f69d3e47167 100644 --- a/lib/topic_view.rb +++ b/lib/topic_view.rb @@ -174,7 +174,7 @@ class TopicView # show poster avatar @desired_post.user.avatar_template_url.gsub("{size}", "100") if @desired_post.user else - @topic.image_url || SiteSetting.default_opengraph_image_url + @topic.image_url end end