# layoutTitle

## Purpose

Used in layouts to output the contents of the title tag of the decorated page. Equivalent to the SiteMesh <decorator:title /> tag.

## Examples

Example decorated page:

    <html>
       <head>
            <title><g:layoutTitle default="Some Title" /></title>
            <script src="global.js" />
            <g:layoutHead />
       </head>
       <body><g:layoutBody /></body>
    </html>

Results in:

    <html>
       <head>
            <title>Hello World!</title>
            <script src="global.js" />
            <script src="myscript.js" />
       </head>
       <body>Page to be decorated</body>
    </html>

## Source

Show Source

    def layoutTitle = { attrs ->
            String title = page.title
            if (!title && attrs.'default') title = attrs.'default'
            if (title) out << title
        }