---
title: 山脉网站
description: 一个关于世界上最具标志性的山脉的网站。
---
::my-vue-hero-component{orientation="horizontal"}
#title
欢迎来到山脉网站。
#description
这是山脉网站的描述。
::
这是一个包含 **加粗** 和 _斜体_ 文本的段落。
<script setup lang="ts">
const { data } = await useAsyncData('home', () => {
return queryCollection('content').path('/').first()
})
useSeoMeta({
title: data.value?.title,
description: data.value?.description
})
</script>
<template>
<ContentRenderer :value="data" />
</template>
结合基于文件的简洁性与 Vue 组件的强大。构建内容丰富的网站,从文档页面到复杂应用。
# 调用组件插槽
---
title: 山脉网站
description: 一个关于世界上最具标志性的山脉的网站。
---
::landing-hero
---
image: /mountains/everest.jpg
---
#title
珠穆朗玛峰。
#description
珠穆朗玛峰是世界上最高的山峰,海拔 8848 米。
::
::::
<script setup lang="ts">
defineProps<{
image: string
}>()
</script>
<template>
<section class="flex flex-col sm:flex-row sm:items-center gap-4 py-8 sm:gap-12 sm:py-12">
<div>
<h1 class="text-4xl font-semibold">
<slot name="title" />
</h1>
<div class="text-base text-gray-600 dark:text-gray-300">
<slot name="description" />
</div>
</div>
<img :src="image" class="w-1/2 rounded-lg">
</section>
</template>
<script setup lang="ts">
const { data: posts } = await useAsyncData('blog', () => {
return queryCollection('blog').all()
})
</script>
<template>
<div>
<h1>博客</h1>
<ul>
<li v-for="post in posts" :key="post.id">
<NuxtLink :to="post.path">{{ post.title }}</NuxtLink>
</li>
</ul>
</div>
</template>
import { defineContentConfig, defineCollection } from '@nuxt/content'
import { z } from 'zod'
export default defineContentConfig({
collections: {
blog: defineCollection({
source: 'blog/*.md',
type: 'page',
// 为文档集合定义自定义 schema
schema: z.object({
tags: z.array(z.string()),
image: z.string(),
date: z.Date()
})
})
}
})
使用 Studio 模块 编辑您的 Nuxt Content 网站,这是我们免费且开源的可视化编辑界面,可在生产环境中编辑内容。