This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17128 - Suggestion for HTML5 feature: Templates I've noticed that a lot of websites use similar-looking elements that could be better implemented using "templates" - reusable components that are transcluded into Web pages and take arguments that affect the way th
Summary: Suggestion for HTML5 feature: Templates I've noticed that a lot of websites u...
Status: RESOLVED NEEDSINFO
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Robin Berjon
QA Contact: HTML WG Bugzilla archive list
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-21 00:17 UTC by contributor
Modified: 2013-03-11 15:35 UTC (History)
5 users (show)

See Also:


Attachments

Description contributor 2012-05-21 00:17:51 UTC
Specification: http://www.w3.org/TR/html5/
Multipage: http://www.whatwg.org/C#top
Complete: http://www.whatwg.org/c#top

Comment:
Suggestion for HTML5 feature: Templates

I've noticed that a lot of websites use similar-looking elements that could be
better implemented using "templates" - reusable components that are
transcluded into Web pages and take arguments that affect the way they are
displayed. Most sites that use templates, such as Wikipedia, implement them
through server-side includes (SSIs) - which makes editing wiki pages more
convenient but requires preprocessing each time a page is edited.

In Wikipedia's specialized syntax, the name of the template is enclosed in
double curly braces and parameters are separated by a pipe. For example, a
particular template that tells other editors that a Web page needs to be
cleaned up is inserted into the page, along with a parameter called "date", by
typing:

{{cleanup|date=January 2010}}

This produces (approximately) the message:

"This article may require cleanup to meet Wikipedia's quality standards.
(Tagged since January 2010.)"

This, however, must be replaced with the actual code for the template each
time the page is saved (which the server has no trouble doing but can be
problematic when you do this manually). Additionally, some pages are made
entirely out of templates and the code for these eats away at bandwidth on
slow connections.

So I was thinking: HTML5 should include native support for client-side
template inclusions. This would make it easier to create a uniform appearance
on Web pages when designing them manually, and reduce bandwidth by caching
templates. (External CSS and JS files already reduce bandwidth.) For example,
skins could be implemented through a combination of CSS, JS and templates.

Suggested syntax for templates:

<!-- src attribute tells browser where to get the code for the template -->
<template src="http://not-a-real-url.com/bin/templates/my-template.htt">
 <param name="text">The parameter called "text" goes here.</param>
</template>

Contact me via my talk page on Wikipedia by going to
http://en.wikipedia.org/wiki/User_talk:68.173.113.106 and clicking Edit.

Posted from: 68.173.113.106
User agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5
Comment 1 contributor 2012-07-18 07:21:51 UTC
This bug was cloned to create bug 17947 as part of operation convergence.
Comment 2 Robin Berjon 2013-01-21 15:58:38 UTC
Mass move to "HTML WG"
Comment 3 Robin Berjon 2013-01-21 16:01:25 UTC
Mass move to "HTML WG"
Comment 4 Robin Berjon 2013-03-11 15:35:36 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are
satisfied with this response, please change the state of this bug to CLOSED. If
you have additional information and would like the Editor to reconsider, please
reopen this bug. If you would like to escalate the issue to the full HTML
Working Group, please add the TrackerRequest keyword to this bug, and suggest
title and text for the Tracker Issue; or you may create a Tracker Issue
yourself, if you are able to do so. For more details, see this document:

   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Additional Information Needed
Change Description: none yet
Rationale:

Note that there is a proposal for this: http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/

If that doesn't work for you, please provide us with more details of what isn't supported by that solution (and if you feel like it, you can even produce a document as detailed in: http://www.w3.org/html/wg/wiki/ExtensionHowTo)