JSON Installed

Add support for JSON or JSONC to store data and create pages.

Options See on deno.land

extensions string[]

The list of extensions this plugin applies to

Default:
[ ".json", ".jsonc" ]
pageSubExtension string

Optional sub-extension for page files

Default:
".page"

Description

This plugin allows you to create pages and store data using the JSON format. As of Lume 1.18.0, JSONC (JSON with comments) is also supported.

Installation

This plugin is installed by default. 🎉

Configuration

If you want to change the default configuration, use the second argument of lume() function in your _config.ts file.

import lume from "lume/mod.ts";

// JSON plugin configuration
const json = {
  extensions: {
    pages: [".page.json"],
  },
};

const site = lume({}, { json });

export default site;

Create pages

Create a file with the extension .page.json or .page.jsonc in your src folder. For example:

{
  "title": "Welcome to my page",
  "layout": "layouts/main.vto",
  "content": "This is my first post using lume,\nI hope you like it!"
}

Create data files

Create a file with the name _data.json or _data.jsonc or inside a _data directory.