Linking to social network sites
Posted: 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='javascript:window.open("https://twitter.com/share?url={$entry.r ... status=yes")' src='smimg/twitter.png'>
For Facebook and Google: First install and active the Facebook plugin at https://github.com/s9y/additional_plugi ... t_facebook. This generates <meta property="og:..." /> fields in the header. Then use:
<img title='Facebook' onclick='javascript:window.open("http://www.facebook.com/sharer.php?u={$ ... status=yes")' src='smimg/facebook.png'>
<img title='Google+' onclick='javascript:window.open("https://plus.google.com/share?url={$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='javascript:window.open("http://www.pinterest.com/pin/create/but ... 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?
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='javascript:window.open("https://twitter.com/share?url={$entry.r ... status=yes")' src='smimg/twitter.png'>
For Facebook and Google: First install and active the Facebook plugin at https://github.com/s9y/additional_plugi ... t_facebook. This generates <meta property="og:..." /> fields in the header. Then use:
<img title='Facebook' onclick='javascript:window.open("http://www.facebook.com/sharer.php?u={$ ... status=yes")' src='smimg/facebook.png'>
<img title='Google+' onclick='javascript:window.open("https://plus.google.com/share?url={$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='javascript:window.open("http://www.pinterest.com/pin/create/but ... 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?