FEATURE: add opengraph and twitter meta tags on every page
This commit is contained in:
parent
0a1d7896bf
commit
a39929d12e
|
@ -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
|
||||
|
|
|
@ -104,3 +104,7 @@
|
|||
<br/>
|
||||
|
||||
<% end %>
|
||||
|
||||
<% content_for :head do %>
|
||||
<%= raw crawlable_meta_data(title: SiteSetting.title, description: SiteSetting.site_description) %>
|
||||
<% end %>
|
||||
|
|
|
@ -12,3 +12,7 @@
|
|||
</div>
|
||||
|
||||
<% content_for :title do %><%= @title %><% end %>
|
||||
|
||||
<% content_for :head do %>
|
||||
<%= raw crawlable_meta_data(title: SiteSetting.title, description: SiteSetting.site_description) %>
|
||||
<% end %>
|
||||
|
|
|
@ -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 %>
|
||||
|
|
|
@ -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 %>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue