Exploring advanced Nuxt Content capabilities
Now that you're familiar with the basics, let's explore some advanced features of Nuxt Content.
The metadata you see at the top of this file (between the --- markers) is called front matter. You can add any custom fields you want:
title and description for SEOpublishedAt for sorting by datetags for categorizationfeatured for highlighting special contentThe real power comes from querying your content:
// Get all blog posts
const posts = await queryCollection("content")
.where("_path", "startsWith", "/blog")
.all();
// Get featured posts only
const featured = await queryCollection("content")
.where("featured", true)
.sort("publishedAt", -1)
.all();
// Get a single post
const post = await queryCollection("content").path("/blog/second-post").first();
You can build complex navigation structures:
content/
├── index.md
├── blog/
│ ├── first-post.md
│ └── second-post.md
└── docs/
├── getting-started.md
└── api/
└── reference.md
With MDC, you can use Vue components directly in your Markdown:
::alert{type="success"}
This is a success alert!
::
This post demonstrates advanced features available in Nuxt Content v3.