流星:收到错误 "No Iron.Layout found so you can't use yield"

meteor: getting error "No Iron.Layout found so you can't use yield"

刚刚开始使用流星 按照这个自动表单教程:

http://www.webtempest.com/meteor-js-autoform-tutorial

有这些简单的文件:main.html:

<head>

  <title></title>
</head>
<body>
<div class="container">
    <h1>Posts</h1>

  {{> quickForm collection="Posts" id="insertPostForm" type="insert"}}
</div>

<template name="main">
    <div class="container">
      {{> yield}}
    </div>
</template>
</body>

post.html:

<template name="post">
    <h1>Edit Post</h1>
  {{> quickForm collection="Posts" id="updatePostForm" type="update" doc=this}}
    <a class="btn" href="/">Back</a>
</template>

posts.html:

<template name="posts">
    <h1>Add Post</h1>
  {{> quickForm collection="Posts" id="insertPostForm" type="insert"}}

    <ul>
      {{#each posts}}
          <li><a href="{{pathFor 'post.show'}}">{{title}}</a> - {{content}}</li>
      {{/each}}
    </ul>
</template>

和路由器:

Router.configure({
    layoutTemplate: 'main'
});
Router.route('/', 'posts');
Router.route('/posts/:_id', function () {
    var item = Posts.findOne({_id: this.params._id});
    this.render('post', {data: item});
}, {
    name: 'post.show'
});

当我运行这个时,我得到这个错误:

Error: No Iron.Layout found so you can't use yield! iron_layout.js:410

请问我该怎么做才能解决这个问题?

您 main.html 中的内容无效。 </body> 标签不应位于布局定义之后。将其更改为:

<head>

  <title></title>
</head>
<body>
<div class="container">
    <h1>Posts</h1>

  {{> quickForm collection="Posts" id="insertPostForm" type="insert"}}
</div>
</body>

<template name="main">
    <div class="container">
      {{> yield}}
    </div>
</template>