Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/content/3.advanced/2.content.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,34 @@ export default defineNuxtConfig({
})
```

## Setup comark-content

[comark-content](https://github.com/harlan-zw/harlan-nuxt/tree/main/packages/comark-content) is a Markdown-only content module. Nuxt Robots supports it first-party.

No schema opt in is needed. Write the `robots` key in frontmatter and the module maps it onto the page's `seo.robots`.

```md [content/foo.md]
---
robots: false
---

# Foo
```

Render it with `useSeoMeta()`{lang="ts"} in your catch-all page, the same as with Nuxt Content v3.

```vue [pages/[...slug\].vue]
<script setup lang="ts">
const route = useRoute()
const { data: page } = await useAsyncData(`page-${route.path}`, () => {
return queryCollection('content').path(route.path).first()
})
useSeoMeta(page.value?.seo || {})
</script>
```

See [Usage](#usage) for the values the `robots` key accepts.

## Setup Nuxt Content v2

In Nuxt Content v2 markdown files require either [Document Driven Mode](https://content.nuxt.com/document-driven/introduction) or a `path` key to be set
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"devDependencies": {
"@antfu/eslint-config": "catalog:",
"@arethetypeswrong/cli": "catalog:dev",
"@harlan-zw/comark-content": "catalog:dev",
"@headlessui/vue": "catalog:dev",
"@iconify-json/logos": "catalog:dev",
"@iconify-json/ri": "catalog:dev",
Expand Down
Loading
Loading