mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -05:00
FEATURE: add opengraph and twitter meta tags on every page
This commit is contained in:
parent
0a1d7896bf
commit
a39929d12e
6 changed files with 22 additions and 1 deletions
|
@ -148,6 +148,8 @@ module ApplicationHelper
|
||||||
opts[:image] = "#{uri.scheme}:#{opts[:image]}"
|
opts[:image] = "#{uri.scheme}:#{opts[:image]}"
|
||||||
elsif opts[:image].present? && opts[:image].start_with?("/uploads/")
|
elsif opts[:image].present? && opts[:image].start_with?("/uploads/")
|
||||||
opts[:image] = "#{Discourse.base_url}#{opts[:image]}"
|
opts[:image] = "#{Discourse.base_url}#{opts[:image]}"
|
||||||
|
elsif SiteSetting.default_opengraph_image_url.present?
|
||||||
|
opts[:image] = SiteSetting.default_opengraph_image_url
|
||||||
end
|
end
|
||||||
|
|
||||||
# Add opengraph tags
|
# Add opengraph tags
|
||||||
|
|
|
@ -104,3 +104,7 @@
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% content_for :head do %>
|
||||||
|
<%= raw crawlable_meta_data(title: SiteSetting.title, description: SiteSetting.site_description) %>
|
||||||
|
<% end %>
|
||||||
|
|
|
@ -12,3 +12,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% content_for :title do %><%= @title %><% end %>
|
<% 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)) %>
|
<%= 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) %>
|
<%= raw crawlable_meta_data(title: @category.name, description: @category.description) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<% content_for :head do %>
|
||||||
|
<%= raw crawlable_meta_data(title: SiteSetting.title, description: SiteSetting.site_description) %>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @title %>
|
<% if @title %>
|
||||||
|
|
|
@ -23,4 +23,11 @@
|
||||||
|
|
||||||
<% if @title %>
|
<% if @title %>
|
||||||
<% content_for :title do %><%= @title %><% end %>
|
<% 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 %>
|
<% end %>
|
||||||
|
|
|
@ -174,7 +174,7 @@ class TopicView
|
||||||
# show poster avatar
|
# show poster avatar
|
||||||
@desired_post.user.avatar_template_url.gsub("{size}", "100") if @desired_post.user
|
@desired_post.user.avatar_template_url.gsub("{size}", "100") if @desired_post.user
|
||||||
else
|
else
|
||||||
@topic.image_url || SiteSetting.default_opengraph_image_url
|
@topic.image_url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue