Flow route dynamic template

I’ve been working on my on meteor app. Now it will be great if my maincontent on the mainpage is dynamic. I got this code:

main.html

<head>
  <title>Taskmanager</title>
</head>
<body>
{{> navBar}}
{{> mainlayout}}
</body>

mainlayout.html

<template name="mainlayout">
<main>
{{> Template.dynamic template=main}}
</main>
</template>

routes.js

FlowRouter.route('/', {
name: 'home',
action: function() {
BlazeLayout.render('mainlayout', {main: 'noteOverview'});
}
});

noteoverview.html

<template name="noteOverview">
 <div class="container">
  <h3>Latest Tasks</h3>
 </div>
</template>

When i open the page, the mainlayout doesn’t load the noteoverview.html in. Do i miss something? Thanx for any help!

I know this doesn’t help, but based on the above code, this should work.
Can you make a repo that reproduces the problem?

Delete the main.html file and setup the mainlayout.html file like this below. You don’t need to declare a body tag. You can setup a base layout template to render to the lowest level if you need, and have the content/mainlayout inside that also

<head>
  <title>Taskmanager</title>
</head>

<template name="mainlayout">
  {{> navBar}}
  <main>
    {{> Template.dynamic template=main}}
  </main>
</template>

// You can render dynamically to different areas in the base layout if needed, not only the main content

BlazeLayout.render('layoutAppBase', {
  sidebar: 'mainSidebar',
  sideWindow: 'appSideWindowBase',
  sideNav: 'appSideNav',
  content: 'mainContentExample'
})
1 Like

I solved the problem. I was forgot the add the package: kadira:blaze-layout.

Thanx for the answers, really appreciate it.