Convert Figma logo to code with AI

nuxt logocontent

The file-based CMS for your Nuxt application, powered by Markdown and Vue components.

3,062
622
3,062
383

Top Related Projects

62,681

🚀 Strapi is the leading open-source headless CMS. It’s 100% JavaScript/TypeScript, fully customizable and developer-first.

55,199

The best React-based framework with performance, scalability and security built in.

124,777

The React Framework

16,839

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.

74,645

The world’s fastest framework for building websites.

Quick Overview

Nuxt Content is a powerful module for Nuxt.js that allows you to write content in Markdown, JSON, YAML, XML, and CSV files in your project. It provides a Git-based headless CMS and full-text search capabilities, making it easy to create content-driven websites and applications.

Pros

  • Easy integration with Nuxt.js projects
  • Supports multiple file formats for content creation
  • Built-in full-text search functionality
  • Automatic API generation for content

Cons

  • Learning curve for developers new to Nuxt.js ecosystem
  • Limited customization options for complex content structures
  • Potential performance issues with large content databases
  • Dependency on Nuxt.js framework

Code Examples

  1. Fetching content:
<script setup>
const { data } = await useAsyncData('home', () => queryContent('/').find())
</script>

<template>
  <ContentList v-slot="{ list }">
    <div v-for="article in list" :key="article._path">
      <h2>{{ article.title }}</h2>
      <p>{{ article.description }}</p>
    </div>
  </ContentList>
</template>

This example demonstrates how to fetch and display a list of articles using the queryContent method and the ContentList component.

  1. Using the <ContentDoc> component:
<template>
  <ContentDoc path="/articles/my-article" v-slot="{ doc }">
    <h1>{{ doc.title }}</h1>
    <p>{{ doc.description }}</p>
    <ContentRenderer :value="doc" />
  </ContentDoc>
</template>

This example shows how to use the <ContentDoc> component to fetch and render a specific article.

  1. Implementing full-text search:
<script setup>
const search = ref('')
const { data } = await useAsyncData(`search-${search.value}`, () => queryContent().search(search.value).find())
</script>

<template>
  <input v-model="search" type="search" placeholder="Search...">
  <ul>
    <li v-for="article in data" :key="article._path">
      {{ article.title }}
    </li>
  </ul>
</template>

This example demonstrates how to implement a simple full-text search functionality using the search method provided by Nuxt Content.

Getting Started

  1. Install Nuxt Content in your Nuxt.js project:

    npm install @nuxt/content
    
  2. Add the module to your nuxt.config.ts:

    export default defineNuxtConfig({
      modules: ['@nuxt/content']
    })
    
  3. Create a content/ directory in your project root and add your Markdown files.

  4. Use the <ContentDoc> or <ContentList> components in your pages to display the content.

Competitor Comparisons

62,681

🚀 Strapi is the leading open-source headless CMS. It’s 100% JavaScript/TypeScript, fully customizable and developer-first.

Pros of Strapi

  • Full-featured headless CMS with a user-friendly admin panel
  • Supports multiple databases and content types out of the box
  • Highly customizable with plugins and custom fields

Cons of Strapi

  • Requires more setup and configuration compared to Content
  • Heavier resource usage due to its comprehensive feature set
  • Steeper learning curve for developers new to headless CMS

Code Comparison

Strapi (API route):

module.exports = {
  async find(ctx) {
    const entries = await strapi.services.article.find(ctx.query);
    return entries;
  },
};

Content (Nuxt.js component):

<template>
  <div>
    <h1>{{ article.title }}</h1>
    <nuxt-content :document="article" />
  </div>
</template>

<script>
export default {
  async asyncData({ $content }) {
    const article = await $content('articles').fetch()
    return { article }
  }
}
</script>

Summary

Strapi is a powerful headless CMS with extensive features, while Content is a lightweight, file-based content management system integrated with Nuxt.js. Strapi offers more flexibility and scalability for complex projects, but Content provides a simpler, faster setup for Nuxt.js applications. The choice between them depends on project requirements, team expertise, and desired level of customization.

55,199

The best React-based framework with performance, scalability and security built in.

Pros of Gatsby

  • Larger ecosystem with extensive plugin library
  • Better performance optimization out-of-the-box
  • More mature and battle-tested in production environments

Cons of Gatsby

  • Steeper learning curve, especially for GraphQL
  • Slower build times for large sites
  • More complex setup and configuration

Code Comparison

Gatsby:

export const query = graphql`
  query {
    allMarkdownRemark {
      edges {
        node {
          frontmatter {
            title
          }
        }
      }
    }
  }
`

Nuxt Content:

const articles = await this.$content('articles')
  .only(['title', 'date', 'description'])
  .sortBy('date', 'desc')
  .fetch()

Gatsby uses GraphQL for data querying, which can be powerful but more complex. Nuxt Content offers a simpler API for content management, making it easier for developers to get started quickly. However, Gatsby's approach provides more flexibility for complex data structures and sources.

Gatsby excels in performance optimization and has a vast plugin ecosystem, making it suitable for large-scale projects. Nuxt Content, being more lightweight and focused on content management, offers a gentler learning curve and faster setup for smaller to medium-sized projects.

124,777

The React Framework

Pros of Next.js

  • More mature and widely adopted framework with a larger ecosystem
  • Better performance optimization features, including automatic code splitting
  • Supports both static site generation (SSG) and server-side rendering (SSR)

Cons of Next.js

  • Steeper learning curve, especially for developers new to React
  • Less opinionated, which can lead to more decision-making and potential inconsistencies
  • Requires more configuration for advanced features

Code Comparison

Next.js:

import { useRouter } from 'next/router'

function Post() {
  const router = useRouter()
  const { pid } = router.query
  return <p>Post: {pid}</p>
}

export default Post

Content:

<template>
  <article>
    <h1>{{ page.title }}</h1>
    <nuxt-content :document="page" />
  </article>
</template>

<script>
export default {
  async asyncData({ $content, params }) {
    const page = await $content('articles', params.slug).fetch()
    return { page }
  }
}
</script>

Next.js focuses on routing and page structure, while Content emphasizes content management and rendering. Next.js provides more flexibility in page creation, whereas Content offers a simpler approach to working with structured content.

16,839

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.

Pros of Eleventy

  • Language-agnostic: Supports multiple templating languages (Nunjucks, Liquid, Handlebars, etc.)
  • Highly flexible and customizable with a plugin system
  • Faster build times for large sites due to its simplicity

Cons of Eleventy

  • Steeper learning curve for beginners compared to Content's more opinionated structure
  • Lacks built-in features like full-text search and API generation
  • Requires more manual configuration for advanced features

Code Comparison

Eleventy (JavaScript):

module.exports = function(eleventyConfig) {
  eleventyConfig.addPassthroughCopy("src/css");
  return {
    dir: { input: "src", output: "dist" }
  };
};

Content (Vue.js):

export default defineNuxtConfig({
  modules: ['@nuxt/content'],
  content: {
    documentDriven: true
  }
});

Both Eleventy and Content are popular static site generators, but they cater to different needs. Eleventy offers more flexibility and language options, making it suitable for developers who prefer granular control. Content, on the other hand, provides a more streamlined experience within the Nuxt.js ecosystem, offering built-in features that simplify content management and API creation. The choice between the two depends on the project requirements, team expertise, and desired level of customization.

74,645

The world’s fastest framework for building websites.

Pros of Hugo

  • Faster build times for large sites
  • No dependencies, single binary executable
  • Extensive theme ecosystem

Cons of Hugo

  • Steeper learning curve for non-Go developers
  • Less flexibility in content structure
  • Limited built-in dynamic functionality

Code Comparison

Hugo (Go template):

{{ range .Pages }}
  <h2>{{ .Title }}</h2>
  {{ .Content }}
{{ end }}

Nuxt Content (Vue.js):

<template>
  <div v-for="page in pages" :key="page.slug">
    <h2>{{ page.title }}</h2>
    <nuxt-content :document="page" />
  </div>
</template>

Key Differences

  1. Language: Hugo uses Go templates, while Nuxt Content uses Vue.js components
  2. Content handling: Hugo processes Markdown files directly, Nuxt Content uses a Git-based CMS approach
  3. Ecosystem: Hugo has a larger theme collection, Nuxt Content integrates seamlessly with Nuxt.js applications
  4. Performance: Hugo excels in build speed, Nuxt Content offers more dynamic content capabilities
  5. Learning curve: Hugo may be challenging for non-Go developers, Nuxt Content is more accessible for JavaScript developers

Both tools are powerful static site generators, but they cater to different use cases and developer preferences. Hugo is ideal for large static sites with complex taxonomies, while Nuxt Content shines in JavaScript-heavy projects requiring dynamic content management.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

nuxt-content-social-card

Nuxt Content

npm version npm downloads License Nuxt Volta

Nuxt Content reads the content/ directory in your project, parses .md, .yml, .csv or .json files and creates a powerful data layer for your application. Bonus, use Vue components in Markdown with the MDC syntax.

Features

  • Nuxt 3 support
  • A Markdown syntax made for Vue components (MDC)
  • Navigation generation
  • Code highlighting with Shiki
  • Blazing fast hot module replacement in development
  • Powerful query builder (MongoDB like)
  • Table of contents generation
  • Also handles CSV, YAML and JSON(5)
  • Extend with hooks and content plugins
  • ... and more

Nuxt 2

Nuxt 2 is supported with Content v1, documentation is on https://content.nuxt.com/v1 and the code on the v1 branch.

💻 Development

[!NOTE] This repository uses bash scripts for development and testing. If you are on Windows, you can use WSL or Git Bash.

  • Clone repository
  • Install dependencies using pnpm install
  • Prepare using pnpm prepare
  • Build using pnpm build
  • Try playground using pnpm dev
  • Test using pnpm test

License

MIT - Made with 💚

NPM DownloadsLast 30 Days