Layouts

Matt Hinchliffe edited this page Sep 26, 2013 · 4 revisions

Layouts are re-usable templates to receive compiled pages and will usually be formed of a document outline and partials. Layouts will inherit the current page data set and the compiled page.

The templating documentation contains more information about template syntax.

Note that the compiled page data must be output with unescaped HTML using a triple mustache: {{{content}}}.

Examples

~/robot-project/pages/home.html:

---
layout: default
title: Home
---
<h1>
	{{page.title}}
</h1>
<p>
	Welcome to {{data.site.name}}!
</p>

~/robot-project/layouts/default.html

<!doctype html>
<html>
<head>
	<title>{{page.title}} | {{data.site.name}}</title>
</head>
<body>
	<div class="wrap">
		{{> header}}
		<div class="content">
			{{{content}}}
		</div>
		{{> footer}}
	</div>
</body>
</html>

Using Robot: Previous: Partials, Next: Pages