Setting up the post route
To be able to show a full post page, we need to create a post template, which can be loaded when the user clicks on a post.
We create a file called post.html
inside our my-meteor-blog/client/templates
folder with the following template code:
<template name="post"> <h1>{{title}}</h1> <h2>{{description}}</h2> <small> Posted {{formatTime timeCreated "fromNow"}} by {{author}} </small> <div class="postContent"> {{#markdown}} {{text}} {{/markdown}} </div> </template>
This simple template displays all the information of a blog post and even reuses our {{formatTime}}
helper we created earlier in this book from our template-helper.js
file. We used this to format at the time the post was created.
We can't see this template yet, as we first have to create a publication and route for this page.
Creating a single-post publication
In order to show the full post's data in this template, we need to...