Page 1 of 1

Linking to social network sites

Posted: Mon Feb 24, 2014 7:55 pm
by nealk
Hi all,

I'm trying to give my blog entries links so people can easily post the entries to Facebook, Twitter, etc. I'm doing this in my entries.tpl file, inside the {foreach $entries...} loop.

The good news: I got Twitter, Facebook, and Google+ to work.
The bad news: I cannot seem to figure out Pinterest. I'm hoping someone can help.

For Twitter, they just want the URL. So I use:
<img title='Twitter' onclick='"{$entry.r ... status=yes")' src='smimg/twitter.png'>

For Facebook and Google: First install and active the Facebook plugin at ... t_facebook. This generates <meta property="og:..." /> fields in the header. Then use:
<img title='Facebook' onclick='"{$ ... status=yes")' src='smimg/facebook.png'>
<img title='Google+' onclick='"{$ent ... status=yes")' src='smimg/google.png'>

(BTW, my social media images in smimg/ are just small icons for each service.)

The problem is with Pinterest...
<img title='Pinterest' onclick='" ... status=yes")' src='smimg/pinterest.png'>

With Pinterest, they need a url (got it), description (got it), and a picture (media=url). I don't know how to extract the first picture's URL from the blog entry. Does anyone know how to do this?

Re: Linking to social network sites

Posted: Mon Feb 24, 2014 8:17 pm
by Timbalu

You could try to write your own modifier to regex the entry content for an image, like peggylon demonstrated here (third post).

Or maybe just use a dummy image, always available.