Docs > Tags > extends
The <content:extends> tag is used for template inheritance.
A template can only contain one <content:extends> tag, and it must be the first tag in the template. The template attribute names another template from which the current template inherits. Any element of the parent template can be selectively overwritten, matched by id.
For example, consider this master template, called "Template A":
Note that any tag in the parent template can be overriden; it doesn't have to be a <div>, or a child of the <body> tag, but it does have to be uniquely identified by id. It could even be a <content> tag.
A child template can override more than one element in the template it inherits from.
For example, consider this master template, called "Template A":
<html>Now look at this template, "Template B", which extends "Template A":
<head>
<title><page:name/></title>
</head>
<body>
<xyz:header/>
<div id="main"></div>
</body>
</html>
<content:extends template="Template A">This template will inherit all the markup from its parent, but overrides the "main" div with its own markup.
<div id="main">
<h1><content:string id="headline"/></h1>
<content:text name="description" height="100"/>
</div>
Note that any tag in the parent template can be overriden; it doesn't have to be a <div>, or a child of the <body> tag, but it does have to be uniquely identified by id. It could even be a <content> tag.
A child template can override more than one element in the template it inherits from.



