Ignore

Please note that your browser is not supported.

We recommend upgrading to the latest Firefox or Google Chrome.

Frontend: Page Titles

Page titles can be defined right inside your view templates. Simply use the title key in a front matter block at the top of your template:

---
title: My App
---

...

The title will be set for you when Pakyow composes the complete view.

Building dynamic titles

Page titles can also contain dynamic values. For example, in a blog the title for the "show post" page should include the title of the current post. But since the post is pulled from the database when the view is rendered, these values can't be hardcoded.

Fortunately there's a way to handle these more complex cases:

---
title: {post.title} - My App
---

...

Assuming the backend exposes an object for post, the value for the exposed object's title attribute will be used. Here's an example:

expose :post, {
  title: "Hello Web"
}

The rendered page title would be "Hello Web - My App".

Page title inheritance

If a layout defines a title in its front matter block, all pages rendered with the layout will inherit its title. To override the default value for a page, just define a title in the front matter block for the page. Titles defined in a page always have precedence over the value from the page's layout.

Next Up: Front-Matter