pavelk2 / social-feed

JavaScript plugin that shows a user feed from the most popular social networks
http://pavelk2.github.io/social-feed-example/
MIT License
963 stars 304 forks source link

How can I grab the attachment url through the template? #278

Open liquidvisual opened 6 years ago

liquidvisual commented 6 years ago

Is there any documentation to show all the template variables available?

I'm using social feed for Instagram and I just want to grab the image URLs.

Eg.

{{=it.attachment_url}}

How to do this?

ghost commented 6 years ago

I just ran into the same problem, and from what I can see, you can't. The attachment property of the object is hard coded as <img class="attachment" src="SOURCE">.

johncarter- commented 6 years ago

Hey guys,

I had the same problem. You can add this line of code after line 285 on jquery.socialfeed.js:

So it is wrapped in the if statement:

if (image_url) {
     post.attachment_url = image_url; // this will allow use of {{it.attachment_url}} in your template
     post.attachment = '<img class="attachment" src="' + image_url + '" />';
}
ghost commented 6 years ago

Yes, this is what I did as well - note that you will have to do this for every social network you're using!