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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@11tyrocks/eleventy-plugin-collection-schemas

v0.1.1

Published

Enforce a typed frontmatter schema for templates within an Eleventy collection.

Downloads

26

Readme

Eleventy Plugin: Collection Schemas

Enforce a typed frontmatter schema for templates within an Eleventy collection.

Define a unique schema per collection, then receive output during development and builds to note incorrectly typed, missing, invalid, or misplaced custom data keys.

Terminal output example shown in VS Code using the theme Apollo Midnight

Conditions evaluted for:

  • Missing required meta keys: [LIST]
  • Possibly misplaced meta keys: [LIST]
  • Incorrect type for meta [KEY], change to [TYPE]
  • Invalid meta keys: [LIST]

Invalid catches typos or extra, untyped keys that may need to be added to the schema.

Installation and Usage

Install the plugin:

npm install @11tyrocks/eleventy-plugin-collection-schemas

Then, include it in your .eleventy.js config file:

const collectionSchemas = require("@11tyrocks/eleventy-plugin-collection-schemas");

module.exports = (eleventyConfig) => {
  eleventyConfig.addPlugin(collectionSchemas);
};

You'll also need to create or add to a global eleventyComputed.js file which should live in your global data directory (default: _data). This is to enable access of the total computed page data to the plugin.

module.exports = {
  metaSchema: function (data) {
    return this.metaSchema(data);
  },
};

The plugin works by adding a custom data extension (plugin default: .meta). This .meta file works similar to a directory data file, so it will need the same name as the parent directory of your collection. To associate the schema with the collection, the collection will also need the same name.

For each collection you want to enforce a schema for, you'll need to have the following setup, which assumes a collection named pages:

pages/
  pages.meta
  pages.json
  page-one.md <- content in any templating language

Where pages.json is a directory data file that creates the collection via the tags mechanism:

{
  "tags": "pages"
}

Tip: You can also use the directory data file to change the permalink for all templates in a collection if you don't want them to have the collection name as URL base.

Schema Format

The content of the .meta file is JSON formatted, with the parent key being the name of your custom data key, and the child properties of type and required.

{
  "title": {
    "type": "string",
    "required": true
  },
  "draft": {
    "type": "boolean",
    "required": false
  },
  "categories": {
    "type": "array",
    "required": false
  },
  "order": {
    "type": "number",
    "required": true
  }
}

Note

Data that Eleventy expects such as date should not be included in your schema, only custom data.

Use in templates

To adhere to your schema within templates, the default is to nest the schema-defined properties under a meta key (configurable).

---
meta:
  title: "My Page Title"
  order: 3
  description: "One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin."
---

Config Options

| Option | Type | Default | Description | | ------------- | ------ | ------- | ----------------------------------- | | metaKey | string | 'meta' | Key to define data within templates | | metaExtension | string | 'meta' | File extension to use for schemas |

Schema Limitations

  • Only one level of schema data is currently possible
  • Only the top-level collection is used to locate schemas