Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fast Addthis: no external js/css/images + no backlinks to addthis
branch: master

This branch is even with grosser:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
assets
lib
spec
Gemfile
Gemfile.lock
Rakefile
Readme.md
VERSION
static_addthis.gemspec

Readme.md

Advantages:

  • Pagespeed: no additional js/css files + no js execution time
  • Security: no flash tracking pixel from addthis
  • Offline access: everything working without an internet connection
  • SEO: no backlinks to addthis

Install

rails plugin install git://github.com/grosser/static_addthis.git
  • copy css from assets/static_addthis.css (0.2kb) to public and include it
  • copy assets/addthis_sprite.png into public/images

Usage

# app/helpers/application_helper.rb
def add_this(options)
  # add google analytics tracking
  url = request.request_uri
  url += url.include?('?') ? '&' : '?'
  url += 'utm_source=add_this&utm_medium=%{provider}'

  StaticAddthis.icons(options.reverse_merge(
    :title => @page_title,
    :url => request.request_uri,
    :username => 'myaddthisusername',
    :uid => '12345'
  ))
end

# in view
<%= add_this :providers => ['Facebook', 'Twitter', '|', 'more'] %>

# adding a custom provider
<%= add_this(:providers => ['Twitter', 'MyStuff', 'more']).sub('MyStuff', link_to('MyStuff', '/my_stuff')) %>

# without icons
<%= add_this :providers => ['more'], :only_text => true %>

# custom translations
<%= add_this :providers => ['Facebook', 'Twitter', 'more'], :text => "Share on %{provider}", :show_text => true, :more_text => 'All...' %>

# just need some icons ?
<%= StaticAddthis.social_icon('Facebook') %>

Author

Michael Grosser
michael@grosser.it
Hereby placed under public domain, do what you want, just do not hold me accountable...

Something went wrong with that request. Please try again.