Add VK share for topics


(Den Andreychuk) #1

Can I allow user to share their topics in VK (vk.com)? I need to add a new button like facebook or twitter.


(Jeff Atwood) #2

Do we have a tutorial for this @dax? Might be a good thing to have, if someone wants to customize the share buttons or add a new one.


(Joffrey Jaffeux) #4

@techAPJ could you review this please:

It will allow to have this code:

<script type="text/discourse-plugin" version="0.8.23">
  api.addSharingSource({
    id: "vk",
    icon: "vk",
    generateUrl: function(link, title) {
      return "http://vk.com/share.php?url=" + encodeURIComponent(link)  + "&title=" + 
encodeURIComponent(title);
    },
    shouldOpenInPopup: true,
    popupHeight: 265
  })
</script>

Which will display the VK sharing icon correctly:

Concerning this pull request, reading it you will notice that I added a method to bypass the existing site setting. The reasoning behind is that it’s probably a very good use case for theme components, that way we can keep core sharing methods (google+/facebook/twitter/email) and admin can decide which one he wants to show. But, plugins and theme components can have more control and extend the site setting if only some users wants to use a theme component to have sharing to specific third party.


(Arpit Jalan) #5

Sounds good to me. PR merged. :+1:


(Joffrey Jaffeux) #6

(Daniela) #7

The theme component is now ready