如何在meteor中添加模板?

如何在meteor中添加模板?,meteor,meteor-blaze,Meteor,Meteor Blaze,我正在学习流星框架。我正在尝试渲染模板,但它引发以下错误: Errors prevented startup: While processing files with static-html (for target web.browser): client/html/sidebar.html:1: Expected <head> or <body> tag 阻止启动的错误: 使用静态html处理文件时(对于目标web.browser): client/html/sid

我正在学习流星框架。我正在尝试渲染模板,但它引发以下错误:

Errors prevented startup:

While processing files with static-html (for target web.browser):
client/html/sidebar.html:1: Expected <head> or <body> tag
阻止启动的错误:
使用静态html处理文件时(对于目标web.browser):
client/html/sidebar.html:1:预期为或标记
我的layout.html文件如下:

<body>

    {{> sidebar}}

</body>
<template name="sidebar">
        <h1>Hello</h1>
</template>

{{>侧边栏}
sidebar.html文件如下所示:

<body>

    {{> sidebar}}

</body>
<template name="sidebar">
        <h1>Hello</h1>
</template>

你好

为什么它不在layout.html上呈现???

用一个名为“layout”的模板替换您的body标记(例如),并将此模板作为路由器配置中的layoutTemplate

<template name="layout">

  {{> sidebar}}

  {{> yield}}

</template>

看起来您的问题在于您使用的是
静态html
包,而不是
blaze html模板
,这意味着所有模板代码都不会被处理

做:


在您的项目文件夹中,查看这是否有帮助

我必须添加到路由器的位置。在/lib文件夹中的文件中的任意位置配置。我称我的文件为“router.js”。请确认您正在使用IronRouter。我相信项目默认使用FlowRouter。在这种情况下,我不知道如何配置您的路由器。