diff --git a/app/controllers/badges_controller.rb b/app/controllers/badges_controller.rb index e7991c9de9a..432489a3d43 100644 --- a/app/controllers/badges_controller.rb +++ b/app/controllers/badges_controller.rb @@ -38,20 +38,20 @@ class BadgesController < ApplicationController raise Discourse::NotFound unless SiteSetting.enable_badges params.require(:id) - badge = Badge.enabled.find(params[:id]) + @badge = Badge.enabled.find(params[:id]) 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 user_badge.notification.update_attributes read: true 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| format.html do store_preloaded "badge", serialized - render "default/empty" + render :show end format.json { render json: serialized } end diff --git a/app/views/badges/show.html.erb b/app/views/badges/show.html.erb new file mode 100644 index 00000000000..964870488fe --- /dev/null +++ b/app/views/badges/show.html.erb @@ -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 %>