The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Mojolicious::Plugin::ShareHelpers - A Mojolicious Plugin for generate share urls, buttons and meta for Twitter, Facebook, VKontakte, MyMailRU and Google Plus


  # Mojolicious

  # Mojolicious::Lite
  plugin 'share_helpers';

  # share urls:
  <a href="<%== share_url 'twitter',   url => $url, text => $text, via => 'sharifulin' %>">Share to Twitter</a>
  <a href="<%== share_url 'facebook',  url => $url, text => $text %>">Share to Facebook</a>
  <a href="<%== share_url 'vkontakte', url => $url %>">Share to ВКонтакте</a>
  <a href="<%== share_url 'mymailru',  url => $url %>">Share to Мой Мир</a>

  # share buttons:
  %== share_button 'twitter',   url => '', text => 'Viva la revolution!', via => 'sharifulin';
  %== share_button 'facebook',  url => '', type => 'button_count', title => 'Share it';
  %== share_button 'vkontakte', url => '', type => 'round', title => 'Save';
  %== share_button 'mymailru',  url => '', type => 'button_count', title => 'Share to Мой Мир';

  # google plus button +1:
  %== share_button 'google+', lang => 'ru'
  %== share_button 'google+', noscript => 1, size => 'tall', url => ''

  # generate meta for share
  %== share_meta title => 'Mojolicious', description => 'Viva la revolition!', url => '', image => ''
  %== share_meta title => 'Mojolicious', description => 'Viva la revolition!', url => '', image => '', og => 1, fb_app_id => 1234567890, site_name => 'Site Name'

  # check share agent, it may returns string such as 'facebook' or 'twitter' or 'vkontakte' or empty string
  %= is_share_agent


Mojolicous::Plugin::ShareHelpers is a plugin for generate share url, share button and share meta (Twitter, Facebook, VKontakte).

Plugin adds a share_url, share_button, share_meta and is_share_agent helpers to Mojolicious.



Mojolicious::Plugin::ShareHelpers inherits all methods from Mojolicious::Plugin and implements the following new ones.



Register plugin hooks in Mojolicious application.


Mojolicious, Mojolicious::Guides,


Anatoly Sharifulin <>


Please report any bugs or feature requests to bug-mojolicious-plugin-sharehelpers at, or through the web interface at We will be notified, and then you'll automatically be notified of progress on your bug as we make changes.


Copyright (C) 2010-2013 by Anatoly Sharifulin.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.