Add VK share for topics

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

2 Likes

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.

2 Likes

@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.

10 Likes

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

8 Likes

The theme component is now ready

5 Likes