How to show all attributes of the post


#1

When I access a specific post, it shows only its title.
How can I change the code so I can see its body as well?

At the moment, I can see the body only in edit mode.

post_page.html:

<template name="postPage">
    <div class="post-page page">
        {{> postItem}}
        <ul class="comments">
            {{#each comments}}
                {{> commentItem}}
            {{/each}}
        </ul>
        {{#if currentUser}}
            {{> commentSubmit}}
        {{else}}
            <p>Please log in to leave a comment.</p>
        {{/if}}
    </div>
</template>

post_page.js:

Template.postPage.helpers({
    comments: function () {
        return Comments.find({postId: this._id});
    }
});

The repo https://github.com/tenzan/blog
Deployed at http://askar-blog.meteor.com/


#2

Hi, try it.

<template name="postItem">
<div class="post">
    <div class="post-content">
        <h3><a href="{{pathFor 'postPage'}}">{{title}}</a></h3>
        <p>
            submitted by {{author}},
            <a href="{{pathFor 'postPage'}}">{{commentsCount}} comments</a>
            {{#if ownPost}}<a href="{{pathFor 'postEdit'}}">Edit</a>{{/if}}
        </p>
       <p>{{{body}}}</p>
    </div>
</div>

#4

I just noticed it’s now showing in the posts list, which I don’t want.

I want to show post’s body only when I access that specific post: <url>://posts/:id


#5

Hi, my mistake.
add {{{body}}} to post_page.html.

{{> postItem}}
{{{body}}}