Forum

Thread tagged as: Question, Problem, Blog

Facebook share blog post button

Hi,

I'm keen to have a share button for a specific blog post both from the news page which lists 10 recent posts and also from the post page.

Can you shed any light on how to do this?

Using a template I tried this:

<div class="fb-share-button" 
data-href="http://stanmore.menczykowski.co.uk/news/news-post.php?s=<perch:blog id="postSlug" type="text" />"></div>

But the URL did not work.

Adam Menczykowski

Adam Menczykowski 1 points

  • 4 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Similar to implementing a like button (I searched for "Facebook" in the docs)

http://solutions.grabaperch.com/integrations/adding-facebook-like-buttons

Thanks,

However the like button does not get the full current URL. It gets:

data-href="http://stanmore.menczykowski.co.uk/news/news-post.php?s="

What comes after the ?s= - the slug - is crucial to make the URL work.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

What is now in your template?

Simply:

<div class="fb-like" data-send="true" data-width="450" data-show-faces="true"></div>

The current page url example for a post would be:

http://dev.stanmore/news/news-post.php?s=new-positions-available-at-stanmore

Drew McLellan

Drew McLellan 2633 points
Perch Support

That looks more like a Facebook issue than a Perch one. In that page we also detail how you can set the specific URL you want.