Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9043621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T10:46:25+00:00 2026-06-16T10:46:25+00:00

I am using a Template to Generate HTML Tag Attributes in Meteor, but is

  • 0

I am using a Template to Generate HTML Tag Attributes in Meteor, but is seems to be broken. I can’t put a template inside an HTML tag in meteor and I want to know why.

I’m using meteor-router for routing. Since meteor basically only allows a single layout, I wanted to add a class to the body indicating the current view name, like so:

/client/layout.html:

<head>
  <title>Meteor App</title>
</head>

<body {{> body-attributes}}>
  {{renderPage}}
</body>

<template name="body-attributes">data-view-name="{{page}}" class="{{page}}"<template>

So that I could do this in /client/layout.js:

Template['body-attributes'].page = function () {
  return Meteor.Router.page();
};

But that didn’t work, I got an error from the app saying that attributes on the body are not supported. Changing layout.html to this:

<head>
  <title>Meteor App</title>
</head>

<body>
  <div {{> body-attributes}}>
      {{renderPage}}
  </div>
</body>

<template name="body-attributes">data-view-name="{{page}}" class="layout-container {{page}}"<template>

Resulted in totally broken HTML. The browser shows a ‘>’ before the page, and the console elements panel looks like so:
Console screenshots

Why doesn’t that work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T10:46:26+00:00Added an answer on June 16, 2026 at 10:46 am

    Calling {{> body-attributes}} inside an HTML tag (in your case, the body tag) ultimately means that Meteor will inject a DocumentFragment into the DOM at that location.

    For the sake of reactivity, these DocumentFragments are not vanilla reproductions of the markup in your template, but rather are wrapped up in special Meteoresque reactivity tags that help the backend engine keep the Template updated. You can see this by invoking the Template function and investigating what _domFrag looks like:

    var _domFrag = Template.myTemplateName();
    

    So, Templates in a meteor context are not designed to be embedded as attributes on HTML tags because it’s injecting additional tags within the tag itself. Your second attempt is more in line with the way the framework works.

    Hope that helps explain this behavior.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to generate a html template to a pdf file using pisa. I
I'm using freemarker to generate a freemarker template. But I need some way to
I need to generate a HTML using a Genshi template. The Html is, basicaly
I'm using the jQuery template plugin to generate HTML from JSON data which the
I am using a named template to generate the html for an object hanging
I want to generate HTML pages with rst2html, using my own templates. these templates
I dynamically generate my html using the django form template everything works fine except
I am trying to generate a PDF using HTML template. i am having trouble
Context: HTML widgets generated using a Django ModelForm and template, jQuery 1.3.2, JavaScript on
I'm trying to define a function using template template parameters (I just want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.