Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

print url in fb share button


Go to End


1662 Views

Avatar
thomas.paulson

Community Member, 107 Posts

13 March 2014 at 8:28pm

I have a product listing page based on product type like the below.

-url-/products/type/Tyre Changer/?category=2

I want to share the above link to FB, I tried print url using {$AbsoluteLink}, but print only -url-/products/.

share.ss
-------------
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-share-button" data-href="{$AbsoluteLink}" data-type="button_count"></div>