FEATURE: add og tags to metadata in individual badges page
This commit is contained in:
parent
5943543ec3
commit
402eaaa773
|
@ -38,20 +38,20 @@ class BadgesController < ApplicationController
|
||||||
raise Discourse::NotFound unless SiteSetting.enable_badges
|
raise Discourse::NotFound unless SiteSetting.enable_badges
|
||||||
|
|
||||||
params.require(:id)
|
params.require(:id)
|
||||||
badge = Badge.enabled.find(params[:id])
|
@badge = Badge.enabled.find(params[:id])
|
||||||
|
|
||||||
if current_user
|
if current_user
|
||||||
user_badge = UserBadge.find_by(user_id: current_user.id, badge_id: badge.id)
|
user_badge = UserBadge.find_by(user_id: current_user.id, badge_id: @badge.id)
|
||||||
if user_badge && user_badge.notification
|
if user_badge && user_badge.notification
|
||||||
user_badge.notification.update_attributes read: true
|
user_badge.notification.update_attributes read: true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
serialized = MultiJson.dump(serialize_data(badge, BadgeSerializer, root: "badge", include_long_description: true))
|
serialized = MultiJson.dump(serialize_data(@badge, BadgeSerializer, root: "badge", include_long_description: true))
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html do
|
format.html do
|
||||||
store_preloaded "badge", serialized
|
store_preloaded "badge", serialized
|
||||||
render "default/empty"
|
render :show
|
||||||
end
|
end
|
||||||
format.json { render json: serialized }
|
format.json { render json: serialized }
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
<% content_for :head do %>
|
||||||
|
<%= raw crawlable_meta_data(title: "#{@badge.display_name} badge on #{SiteSetting.title}", description: @badge.long_description) %>
|
||||||
|
<% end %>
|
Loading…
Reference in New Issue