You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This addon lets you populate `<head>` tag from your Ember code without any direct hacky DOM manipulation. It also provides [ember-cli-fastboot](https://github.com/ember-fastboot/ember-cli-fastboot) compatibility for generating head tags in server-rendered apps.
@@ -25,54 +23,36 @@ ember install ember-cli-head
25
23
26
24
Add `<HeadLayout />` to the top of your application template.
27
25
28
-
```handlebars
29
-
{{!-- app/templates/application.hbs --}}
30
-
31
-
<HeadLayout />
32
-
33
-
{{outlet}}
34
-
```
26
+
```gjs
27
+
// app/templates/application.gjs
35
28
29
+
import { HeadLayout } from 'ember-cli-head';
36
30
37
-
### Version
38
-
39
-
Take into account that version >= 0.3 of this addon require Ember 2.10+ and fastboot >=1.0.rc1. Please use 0.2.X if you don't fulfill both requirements.
40
-
41
-
42
-
## Usage
31
+
<template>
32
+
<HeadLayout>
33
+
<meta property="og:title" content="My App">
34
+
</HeadLayout>
43
35
44
-
### Head template
45
-
46
-
By installing this addon, you will find a new template added to your app, called `head`:
47
-
48
-
```
49
-
app/templates/head.hbs
36
+
{{outlet}}
37
+
</template>
50
38
```
51
39
52
-
The contents of this template will be inserted into the `<head>` element of the page.
53
-
54
-
55
-
### Head data service
56
-
57
-
The addon provides `model` that is scoped to the `head` template. The `model` is actually an alias of the `head-data` service. You can set whatever data you want to be available to the `head` template on this service.
58
-
59
-
⚠️ Warning for Octane apps
60
-
61
-
Because `model` refers to the `head-data` service (and not what a route's `model` hook returns), it is important to use `this.model` (not `@model`) in the `head` template.
62
-
40
+
The contents of HeadLayout's defaukt block will be inserted into the `<head>` element of the page.
If you use `suppressBrowserRender`, the content of `<head>` will be the static FastBoot-rendered content throughout your app's lifecycle.
147
151
152
+
## Upgrade from 2.x to 3.x
153
+
154
+
As of 3.x you need `ember-auto-import` installed and configured to use this addon with Ember CLI applications. See the [ember-auto-import](https://github.com/embroider-build/ember-auto-import) documentation for details.
155
+
156
+
The addon doesn't provide any boilerplate code anymore. You will need to create your own head component and inject the `headData` service.
157
+
158
+
1. Move your head.hbs template to components.
159
+
2. In your new head component, add `@service headData` injection.
160
+
3. If you don't have head-data service, you will have to create it.
0 commit comments