/** * @file * * * User: marand * Date: 30/08/15 * Time: 10:15 */ Template.postItem.helpers({ ownPost: function () { // Template is invoked in the context of a Post, so 'this' is a Post. return this.userId === Meteor.userId(); }, domain: function () { var a = document.createElement('a'); a.href = this.url; return a.hostname; }, commentsCount: function () { return Comments.find({postId: this._id}).count(); } });