npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nuxt-content

v0.1.1

Published

Content Module for Nuxt.js.

Downloads

15

Readme

Nuxt Content Module

Nuxt Content grabs all content in a registered directory and converts each file into a Nuxt route component. The content's front-matter or the file name is used to automatically create the route data.

(Nuxt Content uses vue-content-loader to convert markdown files with front-matter into Vue components.)

Installation

npm install nuxt-content

Basic Setup

There are three places where options can be configured: top level options can be specified under the module options that are passed when the plugin is installed, directory options can be specified under the content property, and page options can be specified in the file's front-matter. See each section below for more details.

For options that can be specified in multiple places, the more specific the location, the higher precedence it takes. Thus: a page's front-matter > a directory's options under the content property > top level options under module property.

Note: All paths are relative to Nuxt Root Directory.

Module Options

Top level configurations can be done inside nuxt.config.js via the modules property when the plugin is installed.

Top Level Module Options:

  • srcDir, String that specifies the directory where the content is located.
  • routePath, String that specifies the parent route, which the content will be nested under. If routePath is "/" then a new route will be created for each file. If it is "/," then a top level route will be created. will be nested under it.
  • content, Array that specifies options for all content under a directory. A 2D array is also allowed to configure multiple content types.

Note: If the routePath is an existing page, the nested content will only appear if <nuxt-child /> is present

modules: [
  [@nuxtjs/content, {
    srcDir: "content",
    routePath: "/"
    content: ["posts", {
      permalink: ":slug"
    }]
  }]
}

Directory Options

Directory specific configurations can also be done under the content property.

Content Directory Options:

  • permalink, String that specifies url path configuration options. The possible options are :slug, :section, :year, :month, :day.
  • isPost, Boolean that specifies whether the content requires a date.

modules: [@nuxtjs/content, { srcDir: "content"} ]

content: [
  ['posts', { // content/posts/2013-01-10-HelloWorld.md -> localhost:3000/2013/hello-world
    routePath: '/',
    permalink: ':year/:slug'
  }],
  ['projects', { // content/projects/NuxtContent.md -> localhost:3000/projects/nuxt-content
    routePath: 'projects',
    permalink: ':section/:slug',
    isPost: false
  }]
]

Page Options

By default, page specific data is extracted from the file name, but it can also be specified inside the front-matter of the respective file.

Front Matter Options:

  • slug, String that overrides the content's url identification name.
  • permalink, String that overrides the content's entire url path.
  • date, Date that overrides the date the post is identified by, in YYYY-MM-DD format.
// `nuxt.config.js`
content: ['posts', {
  routePath: '/',
  permalink: ':year/:slug'
}]

// content/posts/2014-05-10-MyFirstPost.md -> localhost:3000/2014/1st
---
title: "My First Post!"
slug: "1st"
---

# Hello World!

Sites built with using nuxt-content module

License

MIT