From: Alister P. <gsp...@gm...> - 2013-08-23 06:21:43
|
Hi, I'm probably missing something obvious, but I can't see how to change the title of a web page using the template system (one template, multiple pages). The template <head> contains: <title data-template="app:title">Title here</title> and so the app: module must contain a title function, and then the body (amongst other things) contains a <div id='content'></div> If I then have separate files for - about (myapp/about.html) - news (myapp/news.html) - prefs (myapp/prefs.html) which might look like <div data-template="templates:surround data-template-with="templates/page.html" data-template-at="content" > <h1>About this app</h1> … </div> Those "pages" are the obvious place to want to add a <title>. I could write an app:title with a switch that tests the path - but that sounds ugly. Regards, Alister --- I tried this approach - and thought it worked until I looked at the resulting html - the title element ends up in the body. <html> <head> <title id='title>Title here</title> … </head> <body> … <div id='content'></div> </body> </html> fragment (eg about.html) <div> <title data-template="templates:surround" data-template-with="templates/page.html" data-template-at="title">About this App</title> <div data-template="templates:surround" data-template-with="templates/admin.html" data-template-at="content"> <h1>About this App</h1> etc </div> </div> |