|
| 1 | +--- |
| 2 | +title: useContentHead |
| 3 | +description: The useContentHead() composable provides a binding between your content data and useHead() composable. |
| 4 | +--- |
| 5 | + |
| 6 | +## Type |
| 7 | + |
| 8 | +```ts |
| 9 | +function useContentHead(collection: PageCollectionItemBase): void |
| 10 | +``` |
| 11 | + |
| 12 | +## `useContentHead(collection: PageCollectionItemBase)`{lang=ts} |
| 13 | + |
| 14 | + |
| 15 | +The `useContentHead()`{lang="ts-type"} composable provides a binding between your content data and [`useHead()`{lang="ts-type"}](https://nuxt.com/docs/api/composables/use-head) composable. |
| 16 | + |
| 17 | + |
| 18 | +Here is a list supported options that you can define in contents [Front-Matter](/usage/markdown#front-matter). |
| 19 | + |
| 20 | +| Key | Type | Description | |
| 21 | +| ------------------ | :----------------: | ------------------------------------------------------------------------------------------------ | |
| 22 | +| `title`{lang="ts-type"} | `string`{lang="ts-type"} | Will be used as the default value for `seo.title`{lang="ts-type"} | |
| 23 | +| `description`{lang="ts-type"} | `string`{lang="ts-type"} | Will be used as the default value for `seo.description`{lang="ts-type"} | |
| 24 | +| `seo.title`{lang="ts-type"} | `string`{lang="ts-type"} Sets the `<title>`{lang="ts-type"} tag | |
| 25 | +| `description`{lang="ts-type"} | `string`{lang="ts-type"} | Will be used as the default value for `seo.description`{lang="ts-type"} | |
| 26 | +| `seo.description`{lang="ts-type"} | `string`{lang="ts-type"} | Sets the `<meta name="description">`{lang="ts-type"} tag | |
| 27 | +| `seo.image`{lang="ts-type"} | `string \| object`{lang="ts-type"} | Overrides the `<meta property="og:image">`{lang="ts-type"} | |
| 28 | +| `seo.image.src`{lang="ts-type"} | `string`{lang="ts-type"} | The source of the image | |
| 29 | +| `seo.image.alt`{lang="ts-type"} | `string`{lang="ts-type"} | The alt description of the image | |
| 30 | +| `seo.image.xxx`{lang="ts-type"} | `string`{lang="ts-type"} | Any [`og:image:xxx`{lang="ts-type"} compatible](https://ogp.me#structured) attribute | |
| 31 | + |
| 32 | + |
| 33 | +Below you can see a sample content. |
| 34 | + |
| 35 | +```md [example-usage.md] |
| 36 | +--- |
| 37 | +title: 'My Page Title' |
| 38 | +description: 'What a lovely page.' |
| 39 | +seo: |
| 40 | + title: Awesome Page |
| 41 | + description: Best Website event |
| 42 | + meta: |
| 43 | + - name: 'keywords' |
| 44 | + content: 'nuxt, vue, content' |
| 45 | + - name: 'robots' |
| 46 | + content: 'index, follow' |
| 47 | + - name: 'author' |
| 48 | + content: 'NuxtLabs' |
| 49 | + - name: 'copyright' |
| 50 | + content: '© 2022 NuxtLabs' |
| 51 | +--- |
| 52 | +``` |
0 commit comments