Creating a Stumbleupon button with a Single URL

570 Views Asked by At

I'd like to be able to have the stumbleupon button on all my site pages, but always have it "Stumble" my home page. How can I add this functionality to the Button?

Here's what Stumbleupon gives me:

< !-- Place this tag where you want the su badge to render -->

< su:badge layout="5" >< /su:badge >

< !-- Place this snippet wherever appropriate -->

< script type="text/javascript"><br>
  (function() {
    var li = document.createElement('script'); li.type = 'text/javascript'; li.async = true;
    li.src = ('https:' == document.location.protocol ? 'https:' : 'http:') + '//platform.stumbleupon.com/1/widgets.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(li, s);
  })();
< /script>

Here's my site fairivy.com

Thank you!

2

There are 2 best solutions below

2
Ariosa On

you may have to customize that js script that stumblupon provides, try changing this line in the JS, and have it hosted on your own website:

if(this.type=='follow')
return scheme+'www.'+ this.domain+ followBase+'?id='+ this.ref+'&l='+ this.layout;else if(this.type=='bestof')
return scheme+'www.'+ this.domain+ bestofBase+'?'+ this.request.join('&')+'&l='+ this.layout+'&title='+ encodeURIComponent(this.title);

if you use this solution you may have to make a seperate .js with only your main domain.

you would also need to change this line to your custom location:

'//platform.stumbleupon.com/1/widgets.js'
1
snakeboyeric On

Where you want the badge to show, edit the code from this:

    <su:badge layout="5"></su:badge>

To this:

    <su:badge layout="5" location="http://www.fairivy.com/"></su:badge>