Share badges on social media


(Rémi Auguste) #1

Hello world,

I’m trying to enhance my community activeness. In order to do so, I’d like my members to be able to brag about obtaining a badge on social media. It would reinforce the gamification aspect of the forum and lead the community into wanting to obtain badges, thus increasing the overall activity.

Is there a way to share a badge on social media (mainly facebook and twitter) ? If not, what kind of development would it take to do so ? I’m willing to make a plugin if it’s what it takes.

Best regards,

Rémi


(Rafael dos Santos Silva) #2

I think that adding the necessary og tags on the badges page is welcome as a PR to the core.


(Rémi Auguste) #3

Yeah, that too, it would be nice to have the icon and description in the metadata. So if I understand you correctly, metadata description should be handled in the core of the forum and the share button should be a plugin, right ?


(Rafael dos Santos Silva) #4

Yes!

I’m not sure yet.

Do the metadata first, and wait for @codinghorror call on the share button ok?


(Rémi Auguste) #5

I’ll try to see what I can do, I never dived into the core of discourse and I’m not really familiar with ruby. But that sounds like a fun challenge :wink:


(Aashaka) #6

I believe metadata description to the badges page can be added by making a new view badges/show.html.erb which has crawlable_meta_data as content_for head.

I also changed the show method in badges_controller to render to :show , instead of default/empty .

Am unable to see the changes (og tags) in the local instance of discourse set up using vagrant. I am new to the community and would appreciate help with this!


(Mittineague) #7

Hi 7ev3n welcome to the forum

Did you see this?


(Aashaka) #8

Thank you :slight_smile:

Yes. I have gone through the resources provided there, and have a basic idea about the code structure of Discourse.


(Arpit Jalan) #9

That sounds correct.

That is odd. I can see the og (Open Graph) tags just fine on my local dev instance if I create badges/show.html.erb file and removing render "badges/show" in controller.

Perhaps try again, and see index method in CategoriesController for reference implementation?


(Aashaka) #10

Am able to see the change now. Instead of render :show, I left it as render only.

I have submitted a PR for the same. Should the share button be added as a plugin, or in the core?


(Erlend Sogge Heggen) #11

Might as well start it off as a plugin; will be a worthwhile exercise :wink:


(Arpit Jalan) #12

This feature is now available via:

Thanks @7ev3n.


Examples of Sharing Badges To Social Media
(Erlend Sogge Heggen) #13