copenndthagen
copenndthagen

Reputation: 50752

Ember update page title

In my Ember app (actually mine is an engine within a host/parent app), I want to set the page title.

Now while I do

document.title = "Page title I want" 

However, it gets overwritten by the host app i.e. what is set in the index.html

Where can I have the above code to set page title? Already tried adding in beforeModel, didTransition hooks, But that does not work.

Upvotes: 0

Views: 306

Answers (1)

jrjohnson
jrjohnson

Reputation: 2459

I'd highly recommend standardizing across your app and all engines on ember-page-title. Which will allow you to add {{page-title "Blog"}} to a template. It has some additional features that are really nice when working in a larger app, but by delegating all of your title setting needs to a single addon you can have a standard API across your app and all engines for doing this task.

There are other addons that also serve this purpose, but this RFC has movement towards making ember-page-title the default for new ember apps.

Upvotes: 4

Related Questions