-
-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
79 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
title: useContentHead | ||
description: The useContentHead() composable provides a binding between your content data and useHead() composable. | ||
--- | ||
|
||
## Type | ||
|
||
```ts | ||
function useContentHead(collection: PageCollectionItemBase): void | ||
``` | ||
|
||
## `useContentHead(collection: PageCollectionItemBase)`{lang=ts} | ||
|
||
|
||
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. | ||
|
||
|
||
Here is a list supported options that you can define in contents [Front-Matter](/usage/markdown#front-matter). | ||
|
||
| Key | Type | Description | | ||
| ------------------ | :----------------: | ------------------------------------------------------------------------------------------------ | | ||
| `title`{lang="ts-type"} | `string`{lang="ts-type"} | Will be used as the default value for `seo.title`{lang="ts-type"} | | ||
| `description`{lang="ts-type"} | `string`{lang="ts-type"} | Will be used as the default value for `seo.description`{lang="ts-type"} | | ||
| `seo.title`{lang="ts-type"} | `string`{lang="ts-type"} Sets the `<title>`{lang="ts-type"} tag | | ||
| `description`{lang="ts-type"} | `string`{lang="ts-type"} | Will be used as the default value for `seo.description`{lang="ts-type"} | | ||
| `seo.description`{lang="ts-type"} | `string`{lang="ts-type"} | Sets the `<meta name="description">`{lang="ts-type"} tag | | ||
| `seo.image`{lang="ts-type"} | `string \| object`{lang="ts-type"} | Overrides the `<meta property="og:image">`{lang="ts-type"} | | ||
| `seo.image.src`{lang="ts-type"} | `string`{lang="ts-type"} | The source of the image | | ||
| `seo.image.alt`{lang="ts-type"} | `string`{lang="ts-type"} | The alt description of the image | | ||
| `seo.image.xxx`{lang="ts-type"} | `string`{lang="ts-type"} | Any [`og:image:xxx`{lang="ts-type"} compatible](https://ogp.me#structured) attribute | | ||
|
||
|
||
Below you can see a sample content. | ||
|
||
```md [example-usage.md] | ||
--- | ||
title: 'My Page Title' | ||
description: 'What a lovely page.' | ||
seo: | ||
title: Awesome Page | ||
description: Best Website event | ||
meta: | ||
- name: 'keywords' | ||
content: 'nuxt, vue, content' | ||
- name: 'robots' | ||
content: 'index, follow' | ||
- name: 'author' | ||
content: 'NuxtLabs' | ||
- name: 'copyright' | ||
content: '© 2022 NuxtLabs' | ||
--- | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters