ember-cli-page-title

The default blueprint for ember-cli addons.

Usage no npm install needed!

<script type="module">
  import emberCliPageTitle from 'https://cdn.skypack.dev/ember-cli-page-title';
</script>

README

ember-cli-page-title

ember-cli add-on for adding a title to a page

Compatibility

  • Ember.js v3.12 or above
  • Ember CLI v2.13 or above
  • Node.js v10 or above

Installation

ember install ember-cli-page-title

Usage

This add-on allows each Route to have its own page title. You just simply use the @pageTitle decorator.

import Route from '@ember/routing/route';
import { default as pageTitle } from 'ember-cli-page-title';

@pageTitle ('Contact Us')
export default class ContactRoute extends Route {

}

If the destination route does not have a page title, then the current page title remains.

Using templates in titles

The @pageTitle decorator uses Mustache to enable usage of template parameters in the title. The decorator replaces template parameters with values from the corresponding route's controller.

import Route from '@ember/routing/route';
import { default as pageTitle } from 'ember-cli-page-title';

@pageTitle ('Person - {{model.name}}')
export default class PersonRoute extends Route {
  model () {
    return {
      name: 'John Doe'
    } 
  }
}

Contributing

See the Contributing guide for details.

License

This project is licensed under the Apache-2.0 License.