Linking to social network sites

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Posts: 26
Joined: Sun Sep 20, 2009 1:09 am

Linking to social network sites

Post by nealk » Mon Feb 24, 2014 6:55 pm

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?

User avatar
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Linking to social network sites

Post by Timbalu » Mon Feb 24, 2014 7:17 pm


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.

Serendipity Styx Edition and additional_plugins @ @

Post Reply