Book Image

Building Single-page Web Apps with Meteor

By : Fabian Vogelsteller
Book Image

Building Single-page Web Apps with Meteor

By: Fabian Vogelsteller

Overview of this book

Table of Contents (21 chapters)
Building Single-page Web Apps with Meteor
About the Author
About the Reviewers

Listing posts

Now that we have walked through all ways of using helpers and data, I want to introduce a block helper named {{#each}}, which we will probably find the most useful.

If we go through all the examples completed up to now, we can see that it is better to delete all the examples of data context from our home template, the examples.html file, and its examples.js JavaScript file so that we can continue to build our blog cleanly.

The next step is to add a list of blog entries to our home page. For this, we need to create a template for a post preview. This can be done by performing the following steps:

  1. We create a file called postInList.html in our my-meteor-blog/client/templates folder and save it with the following code snippet:

    <template name="postInList">
      <div class="postListItem">
        <h2><a href="#">{{title}}</a></h2>
        <div class="footer">
          Posted by {{author}}