txt[
When generating =>[#topics|topic]-based outputs, Glyph uses _layouts_ to render topics as standalone documents. By default, the following two layout are used:
* code[topic] -- used to render standard topics.
* code[index] -- used to render the index page of your document.

Layouts are nothing more than "fancy" Glyph macros defined using the Glyph language (i.e. by using =>[#rewriting|macro rewriting]) within a single code[.glyph] file.
]
section[
	@title[Topic Layout]
	p[The default layout used to render all web topics (the layout used for web5 topics is very similar) is defined as follows:]
	highlight[=html|
document[
  head[
    style[default.css]
  ]
  body[
    @class[topic]
    section[
      @title[{{title}}]
      @id[{{id}}]
      navigation[{{id}}]
{{contents}}
      navigation[{{id}}]
    ]
  ]
]
	=]
	txt[Note that it takes the following attributes, passed automatically by Glyph when processing each topic:
* code[title] -- the title of the topic.
* code[id] -- the ID of the topic.
* code[contents] -- the body of the topic.
	]
]
section[
	@title[Index Layout]
	@id[index_layout]
	p[The default layout used to render the web index page (the layout used for the web5 index is very similar) is defined as follows:]
	highlight[=html|
document[
  head[
    style[default.css]
  ]
  body[
    @class[topic]
    halftitlepage[
      title[]
      subtitle[]
      author[]
    ]
    frontmatter[
      toc[]
    ]
  ]
]
	=]
	p[Index layouts do not take any attribute or parameter (basically because they are used to produce only one page).]
]
section[
	@title[Creating a Custom Layout]
	txt[
To create a custom layout, proceed as follows:
* Create a @.glyph@ file in the @lib/layouts@ directory, within your project, e.g. @mytopic.glyph@
* Add the layout code, making sure (for topic layouts) that all the attributes (@title@, @id@, @contents@) are specified correctly.
* Set the @output.*.layouts.topic@ setting to the name of the new layout (@mytopic@).
	]
	tip[You can override which layout to use on a specific topic by specifying it in a code[@layout] attribute.]
]