@nera-static/mcp 1.0.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/icon.png +0 -0
- package/.claude-plugin/plugin.json +38 -0
- package/CHANGELOG.md +23 -0
- package/README.md +41 -12
- package/bin/nera-mcp.js +11 -1
- package/package.json +10 -4
- package/skills/nera/SKILL.md +135 -0
- package/skills/nera/recipes/blog.md +59 -0
- package/skills/nera/recipes/business-site.md +57 -0
- package/skills/nera/recipes/contact-form.md +63 -0
- package/skills/nera/recipes/custom-domain.md +49 -0
- package/skills/nera/recipes/images.md +45 -0
- package/skills/nera/recipes/multilingual.md +50 -0
- package/skills/nera/recipes/portfolio.md +51 -0
- package/skills/nera/recipes/search.md +52 -0
- package/src/catalog.js +20 -85
- package/src/resources.js +2 -2
- package/src/runner.js +35 -18
- package/src/runtime.js +213 -0
- package/src/server.js +4 -2
- package/src/tools/cli.js +35 -18
|
Binary file
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nera",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Create, edit, build, validate, preview and publish websites made with Nera, a static site generator: the Nera skill plus the Nera MCP server, which works only inside the sites folder you pick on enable.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Michael Becker"
|
|
7
|
+
},
|
|
8
|
+
"homepage": "https://nera.js.org",
|
|
9
|
+
"repository": "https://github.com/seebaermichi/nera-mcp",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"icon": "./.claude-plugin/icon.png",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"nera",
|
|
14
|
+
"static-site-generator",
|
|
15
|
+
"mcp",
|
|
16
|
+
"markdown",
|
|
17
|
+
"pug"
|
|
18
|
+
],
|
|
19
|
+
"userConfig": {
|
|
20
|
+
"root": {
|
|
21
|
+
"type": "directory",
|
|
22
|
+
"title": "Sites folder",
|
|
23
|
+
"description": "The folder your Nera sites live in. Claude creates new sites in it and may read and change files only inside it.",
|
|
24
|
+
"required": true
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"nera": {
|
|
29
|
+
"command": "npx",
|
|
30
|
+
"args": [
|
|
31
|
+
"-y",
|
|
32
|
+
"@nera-static/mcp@1.2.0",
|
|
33
|
+
"--root",
|
|
34
|
+
"${user_config.root}"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,29 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.2.0] - 2026-11-18
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `create_site` returns the starter's `## First steps` (from its README) as `firstSteps`, `null` without a starter, and its text points to them.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- `create_site` creates and installs the site with `createSite()` from `@nera-static/nera` inside the server instead of spawning `nera new`. Cancelling the call stops the install and removes the new folder again; npm's output goes to the server's log (stderr). Its inputs, checks and result shape are unchanged.
|
|
17
|
+
- `list_starters`, `list_themes`, `list_plugins` and the `nera://catalog/*` resources come from `listCatalog()` of `@nera-static/nera` instead of the server's own registry search. Offline, the starters fall back to the official list the CLI bundles; themes and plugins still report the registry error.
|
|
18
|
+
- `validate` calls `validate()` from `@nera-static/nera`, so it runs the validator version the CLI pins; its records are unchanged. `@nera-static/validate` is no longer a direct dependency.
|
|
19
|
+
- With `NERA_MCP_RUNTIME=bundled` (the Desktop extension), `create_site` hands `createSite` the same environment as every other command, shim folder first on the PATH, so its starter download and `npm install` find the bundled `npm`.
|
|
20
|
+
- Requires `@nera-static/nera` ^1.25.0 (was ^1.23.0), the first release whose `createSite` installs without blocking and takes `signal` and `env`.
|
|
21
|
+
|
|
22
|
+
## [1.1.0] - 2026-11-18
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- A Claude Desktop extension, `nera-mcp-<version>.mcpb`, attached to every GitHub Release: double-click to install, pick the sites folder in its settings. It runs on the Node that ships with Claude Desktop and brings npm itself, so no Node.js installation is needed. `npm run mcpb` builds it; its manifest is made from `package.json` and lists the tools and prompts the server registers.
|
|
27
|
+
- `NERA_MCP_RUNTIME=bundled` (set by the extension): every command the server starts finds `node`, `npm` and `npx` through a shim folder first on its PATH, even with no Node on the system PATH. Without the variable nothing changes.
|
|
28
|
+
- A Claude Code plugin with the Nera skill (copied from `@nera-static/nera`) and the server, and a marketplace in this repository: `claude plugin marketplace add seebaermichi/nera-mcp`, then `claude plugin install nera@nera`. It asks for the sites folder when it is enabled and starts the server at the plugin's own version.
|
|
29
|
+
- A 512×512 Nera icon (the favicon mark of nera.js.org) for the Desktop extension and the Claude Code plugin.
|
|
30
|
+
|
|
8
31
|
## [1.0.1] - 2026-11-18
|
|
9
32
|
|
|
10
33
|
### Added
|
package/README.md
CHANGED
|
@@ -15,14 +15,43 @@ The client starts this command itself; you only add it to the client's configura
|
|
|
15
15
|
|
|
16
16
|
## Requirements
|
|
17
17
|
|
|
18
|
-
- Node.js **22.12 or later** (`node --version`), with `npx
|
|
18
|
+
- Node.js **22.12 or later** (`node --version`), with `npx`. Not needed for the Claude Desktop extension, which brings its own.
|
|
19
19
|
- For `publish`: a GitHub account (and a Netlify account if you host there)
|
|
20
20
|
|
|
21
21
|
## Install
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
### Claude Desktop extension
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
The easiest way, and no Node.js needed: Claude Desktop runs the server on the Node it ships, and the extension brings npm along.
|
|
26
|
+
|
|
27
|
+
1. Download `nera-mcp-<version>.mcpb` from the [latest release](https://github.com/seebaermichi/nera-mcp/releases/latest).
|
|
28
|
+
2. Double-click it and choose **Install** in Claude Desktop.
|
|
29
|
+
3. Pick your **Sites folder** when Claude Desktop asks for it: the folder your sites live in.
|
|
30
|
+
|
|
31
|
+
The extension runs on macOS and Windows. To update, install the `.mcpb` of a newer release.
|
|
32
|
+
|
|
33
|
+
### Claude Code plugin
|
|
34
|
+
|
|
35
|
+
The plugin brings the server and the Nera skill, which teaches Claude how a Nera site is built, in one install:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
claude plugin marketplace add seebaermichi/nera-mcp
|
|
39
|
+
claude plugin install nera@nera
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
or, inside Claude Code 2.1.275 or later, in one step:
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
/plugin install nera --marketplace seebaermichi/nera-mcp
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Claude Code asks for your **Sites folder** when the plugin is enabled. The plugin starts the server with `npx`, so it needs Node.js (see Requirements).
|
|
49
|
+
|
|
50
|
+
### Manual configuration
|
|
51
|
+
|
|
52
|
+
To add the server to a client yourself, replace `/Users/you/Sites` below with the folder your sites should live in. It must exist. Use an absolute path: clients do not expand `~` in their configuration files.
|
|
53
|
+
|
|
54
|
+
#### Claude Code
|
|
26
55
|
|
|
27
56
|
```bash
|
|
28
57
|
claude mcp add --transport stdio nera -- npx -y @nera-static/mcp --root /Users/you/Sites
|
|
@@ -30,9 +59,9 @@ claude mcp add --transport stdio nera -- npx -y @nera-static/mcp --root /Users/y
|
|
|
30
59
|
|
|
31
60
|
Add `--scope user` to have it in every project, or `--scope project` to share it through the project's `.mcp.json`.
|
|
32
61
|
|
|
33
|
-
|
|
62
|
+
#### Claude Desktop
|
|
34
63
|
|
|
35
|
-
Settings → Developer → **Edit Config** opens `claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/`, Windows: `%APPDATA%\Claude\`). Add the server and restart Claude Desktop:
|
|
64
|
+
Without the extension: Settings → Developer → **Edit Config** opens `claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/`, Windows: `%APPDATA%\Claude\`). Add the server and restart Claude Desktop:
|
|
36
65
|
|
|
37
66
|
```json
|
|
38
67
|
{
|
|
@@ -45,11 +74,11 @@ Settings → Developer → **Edit Config** opens `claude_desktop_config.json` (m
|
|
|
45
74
|
}
|
|
46
75
|
```
|
|
47
76
|
|
|
48
|
-
|
|
77
|
+
#### Cursor
|
|
49
78
|
|
|
50
79
|
Add the same `mcpServers` entry to `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project).
|
|
51
80
|
|
|
52
|
-
|
|
81
|
+
#### Codex
|
|
53
82
|
|
|
54
83
|
```bash
|
|
55
84
|
codex mcp add nera -- npx -y @nera-static/mcp --root /Users/you/Sites
|
|
@@ -71,8 +100,8 @@ A **site** is a folder under the root (or the root itself) whose `package.json`
|
|
|
71
100
|
|
|
72
101
|
| Tool | Does |
|
|
73
102
|
| --- | --- |
|
|
74
|
-
| `list_starters`, `list_themes`, `list_plugins` | The starter kits, themes and plugins on npm, official ones first |
|
|
75
|
-
| `create_site` | Creates a site
|
|
103
|
+
| `list_starters`, `list_themes`, `list_plugins` | The starter kits, themes and plugins on npm, official ones first; offline, `list_starters` falls back to the official starters |
|
|
104
|
+
| `create_site` | Creates a site as `nera new` does (`name`, optional `starter`, `theme`, `title`, `lang`) and installs its packages; returns the starter's first steps as `firstSteps` |
|
|
76
105
|
| `list_sites` | The Nera sites under the root |
|
|
77
106
|
| `get_site` | A site's configuration, pages, plugins and theme |
|
|
78
107
|
| `read_page`, `write_page`, `delete_page` | A Markdown page with its frontmatter; `write_page` refuses frontmatter without `layout` |
|
|
@@ -83,7 +112,7 @@ A **site** is a folder under the root (or the root itself) whose `package.json`
|
|
|
83
112
|
| `preview` | Starts `nera dev` and returns the local address; `stop: true` stops it |
|
|
84
113
|
| `publish` | `nera publish` to GitHub Pages or Netlify; returns the sign-in code for you, then the live address |
|
|
85
114
|
|
|
86
|
-
|
|
115
|
+
`create_site`, `validate` and the catalogs call `@nera-static/nera`'s own functions inside the server; `build`, `preview`, `publish` and `add_plugin` run commands, through the site's own `@nera-static/nera` when it has one installed, so the assistant gets the same results as you do in a terminal. A preview or a publish keeps running between calls and stops when the client closes the server.
|
|
87
116
|
|
|
88
117
|
### Resources
|
|
89
118
|
|
|
@@ -107,12 +136,12 @@ The commands run through the site's own `@nera-static/nera` when it has one inst
|
|
|
107
136
|
- The server only touches files below `--root`. A path outside it is refused with an error, never quietly corrected.
|
|
108
137
|
- It never asks for input and never prompts in a terminal; long-running commands run in the background and are stopped when the server exits.
|
|
109
138
|
- `publish` signs in through GitHub's device flow: you enter the code in your browser. Tokens stay where `nera publish` keeps them (the system keychain, or a file only you can read) and are never returned to the assistant or written into a site.
|
|
110
|
-
- The catalogs are read from the public npm registry. Nothing else leaves your computer unless you publish.
|
|
139
|
+
- The catalogs are read from the public npm registry (the starters fall back to the official list when it cannot be reached). `create_site` and `add_plugin` install packages from npm. Nothing else leaves your computer unless you publish.
|
|
111
140
|
|
|
112
141
|
## Compatibility
|
|
113
142
|
|
|
114
143
|
- Node.js 22.12 or later
|
|
115
|
-
- Brings `@nera-static/nera` 1.
|
|
144
|
+
- Brings `@nera-static/nera` 1.25.0 for sites that have none installed. A site with its own CLI installed runs that one: `build` needs 1.9.0 or later (`--json`), `publish` 1.19.0 (1.20.0 for Netlify). `npm update` in the site brings it up to date.
|
|
116
145
|
|
|
117
146
|
## License
|
|
118
147
|
|
package/bin/nera-mcp.js
CHANGED
|
@@ -64,13 +64,23 @@ if (!options.root) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
// the server and the Nera packages it loads come last: only the server needs them
|
|
67
|
-
const [{ StdioServerTransport }, { createServer }, { createProcesses }, { PathError }] = await Promise.all([
|
|
67
|
+
const [{ StdioServerTransport }, { createServer }, { createProcesses }, { PathError }, { setupRuntime }] = await Promise.all([
|
|
68
68
|
import('@modelcontextprotocol/sdk/server/stdio.js'),
|
|
69
69
|
import('../src/server.js'),
|
|
70
70
|
import('../src/processes.js'),
|
|
71
71
|
import('../src/paths.js'),
|
|
72
|
+
import('../src/runtime.js'),
|
|
72
73
|
])
|
|
73
74
|
|
|
75
|
+
// the Desktop extension sets NERA_MCP_RUNTIME=bundled: its Node has no npm and
|
|
76
|
+
// nothing on the PATH, so children get a shim folder for node, npm and npx;
|
|
77
|
+
// the folder goes when this process exits, however it exits
|
|
78
|
+
const runtime = setupRuntime()
|
|
79
|
+
if (runtime) {
|
|
80
|
+
process.on('exit', runtime.remove)
|
|
81
|
+
console.error(`nera-mcp: bundled runtime, node${runtime.npm ? ', npm and npx' : ' (no npm found)'} for children in ${runtime.dir}`)
|
|
82
|
+
}
|
|
83
|
+
|
|
74
84
|
const processes = createProcesses()
|
|
75
85
|
let server
|
|
76
86
|
try {
|
package/package.json
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nera-static/mcp",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "A local MCP server for Nera: lets an AI assistant create, edit, build, validate, preview and publish Nera static sites under one folder",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
|
+
".claude-plugin/icon.png",
|
|
8
|
+
".claude-plugin/plugin.json",
|
|
7
9
|
"bin",
|
|
8
10
|
"docs",
|
|
11
|
+
"skills",
|
|
9
12
|
"src",
|
|
10
13
|
"CHANGELOG.md"
|
|
11
14
|
],
|
|
12
15
|
"scripts": {
|
|
13
16
|
"lint": "eslint .",
|
|
14
17
|
"test": "vitest",
|
|
15
|
-
"prepack": "node scripts/fetch-docs.js"
|
|
18
|
+
"prepack": "node scripts/fetch-docs.js && node scripts/sync-skill.js",
|
|
19
|
+
"mcpb": "node scripts/fetch-docs.js && node scripts/build-mcpb.js",
|
|
20
|
+
"skill": "node scripts/sync-skill.js",
|
|
21
|
+
"version": "node scripts/sync-version.js && git add .claude-plugin/plugin.json"
|
|
16
22
|
},
|
|
17
23
|
"keywords": [
|
|
18
24
|
"nera",
|
|
@@ -41,12 +47,12 @@
|
|
|
41
47
|
"dependencies": {
|
|
42
48
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
43
49
|
"@nera-static/core": "^4.18.3",
|
|
44
|
-
"@nera-static/nera": "^1.
|
|
45
|
-
"@nera-static/validate": "^1.7.0",
|
|
50
|
+
"@nera-static/nera": "^1.25.0",
|
|
46
51
|
"yaml": "^2.9.1",
|
|
47
52
|
"zod": "^4.6.7"
|
|
48
53
|
},
|
|
49
54
|
"devDependencies": {
|
|
55
|
+
"@anthropic-ai/mcpb": "^2.1.2",
|
|
50
56
|
"eslint": "^10.15.0",
|
|
51
57
|
"vitest": "^5.1.1"
|
|
52
58
|
},
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nera
|
|
3
|
+
description: Create, change, check and deploy websites built with Nera, the Markdown + Pug static site generator (npm package @nera-static/nera). Use when package.json lists @nera-static/nera, or when the user asks to build a website, page, blog, portfolio or business site with Nera, or to add a contact form, search, images, a second language or a custom domain to a Nera site. Holds the workflow, the checks to run after every change, and short recipes for common sites and features.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Nera
|
|
7
|
+
|
|
8
|
+
Nera turns Markdown pages and Pug templates into plain HTML. It is not
|
|
9
|
+
Eleventy, Hugo, Astro or Jekyll; do not apply their conventions.
|
|
10
|
+
|
|
11
|
+
## Read this first
|
|
12
|
+
|
|
13
|
+
- **In an existing site, read `AGENTS.md` at the site root before anything
|
|
14
|
+
else.** It holds the folder map, the commands and the traps (pages need
|
|
15
|
+
`layout`, URLs end in `.html`, `public/` is wiped on every build, plugin
|
|
16
|
+
templates are copied and included by hand). This skill does not repeat it.
|
|
17
|
+
- No site yet? Scaffold one (step 1 below), then read its `AGENTS.md`.
|
|
18
|
+
- The "Notes for this site" section at the end of `AGENTS.md` belongs to the
|
|
19
|
+
site owner: follow it, and add to it what the next agent should know.
|
|
20
|
+
|
|
21
|
+
## Workflow
|
|
22
|
+
|
|
23
|
+
1. **Scaffold.** `npx @nera-static/nera new my-site` creates a folder and
|
|
24
|
+
installs; `npx @nera-static/nera new .` fills the current, empty folder.
|
|
25
|
+
Start from an official starter when one fits, with `--starter <name>`:
|
|
26
|
+
- `blank`: a home page, imprint and privacy placeholders, one layout
|
|
27
|
+
- `blog`: sample posts, tags, archive, prev/next, feed, sitemap
|
|
28
|
+
- `business`: home, about, services, opening hours, contact form
|
|
29
|
+
- `portfolio`: project pages with image galleries, about, contact form
|
|
30
|
+
|
|
31
|
+
`--name "<site name>"` and `--lang <code>` set `name` and `lang` in
|
|
32
|
+
`config/app.yaml`. With `--yes`, or without a terminal, it never asks:
|
|
33
|
+
`npx @nera-static/nera new my-site --starter blog --name "My Blog" --lang en --yes`.
|
|
34
|
+
`--theme <name>` starts from a theme instead (not together with
|
|
35
|
+
`--starter`, which brings its own); `--no-install` skips `npm install`.
|
|
36
|
+
2. **Content.** One Markdown file per page in `pages/`, each with YAML
|
|
37
|
+
frontmatter that names its `layout`. Site name, language and texts for
|
|
38
|
+
templates go in `config/app.yaml`. Shared markup goes in `theme/views/`.
|
|
39
|
+
3. **Plugins.** Look for a plugin before writing a feature (see below).
|
|
40
|
+
Install it, configure it in `config/<name>.yaml`, copy its templates with
|
|
41
|
+
its own binary and include them in a layout.
|
|
42
|
+
4. **Validate.** `npx nera validate` and fix every error it reports. It
|
|
43
|
+
finds broken layouts and includes and pages the build would skip.
|
|
44
|
+
5. **Build and check.** `npx nera build --check` and fix what it reports
|
|
45
|
+
(accessibility, privacy and legal hints on the built site).
|
|
46
|
+
`npm run dev` previews on http://localhost:3000 with live reload; stop it
|
|
47
|
+
when you are done.
|
|
48
|
+
6. **Deploy.** `npm run build` writes the finished site into `public/`.
|
|
49
|
+
Upload the contents of `public/` to any static host. See
|
|
50
|
+
[custom-domain](recipes/custom-domain.md) for a domain of your own.
|
|
51
|
+
Or `npx nera publish --yes` puts it on GitHub Pages: it signs in to
|
|
52
|
+
GitHub (the site owner enters the code it prints), creates (or
|
|
53
|
+
reuses) the repository and the deploy workflow, sets `base_path` and
|
|
54
|
+
prints the live URL (`--json` for a JSON object).
|
|
55
|
+
`--domain <host>` sets a custom domain and checks its DNS.
|
|
56
|
+
`npx nera publish --yes --target netlify` deploys to Netlify instead:
|
|
57
|
+
GitHub Actions still builds the site, the site owner also authorizes
|
|
58
|
+
Nera CLI on Netlify through the link it prints, and the Netlify site
|
|
59
|
+
and its repository secrets are set up for you. Netlify's free plan
|
|
60
|
+
covers about 20 deploys a month (300 credits, 15 per deploy) and then
|
|
61
|
+
pauses the sites until the next month, so publish when a batch of
|
|
62
|
+
changes is ready; `nera publish` warns at 80 % of the budget. A later
|
|
63
|
+
run reuses the target kept in `config/publish.yaml`. Pick the target
|
|
64
|
+
with `--target`: GitHub's terms do not allow GitHub Pages as free
|
|
65
|
+
hosting for a business, so use `--target netlify` for a business site
|
|
66
|
+
(without `--target`, a person at a terminal is asked whether the site
|
|
67
|
+
is for a business). To move a published site, run
|
|
68
|
+
`npx nera publish --yes --target <other>`: it sets up the new host and
|
|
69
|
+
swaps the deploy job, leaves the site on the old host online and prints
|
|
70
|
+
how to remove it there (`movedFrom` in `--json`).
|
|
71
|
+
|
|
72
|
+
Repeat steps 2–5 for every change. For machine-readable results, add `--json`:
|
|
73
|
+
`npx nera validate --json`, `npx nera check --json`,
|
|
74
|
+
`npx nera build --check --json`.
|
|
75
|
+
|
|
76
|
+
Existing site on an older Nera? `npx nera update` updates the Nera packages
|
|
77
|
+
and refreshes `AGENTS.md` and this skill.
|
|
78
|
+
|
|
79
|
+
## Look for a plugin before writing a feature
|
|
80
|
+
|
|
81
|
+
Features come from npm packages named `@nera-static/plugin-<name>`. An
|
|
82
|
+
installed plugin loads on the next build, with nothing to register. Do not
|
|
83
|
+
hand-write navigation, a contact form, tags, search, pagination, image
|
|
84
|
+
handling, a sitemap, a feed or a consent banner: a plugin exists for each.
|
|
85
|
+
The catalog: https://github.com/seebaermichi/nera/blob/main/PLUGINS.md
|
|
86
|
+
|
|
87
|
+
The published plugins: canonical-links, code-blocks, consent, contact-form,
|
|
88
|
+
feed, images, link-attributes, navigation, one-page, page-navigation,
|
|
89
|
+
page-pagination, popular-content, search, simple-page-list, sitemap,
|
|
90
|
+
social-media-links, stacks, statistics, tags. Each plugin's README (on npm, or
|
|
91
|
+
`github.com/seebaermichi/nera-plugin-<name>`) lists its config keys and its
|
|
92
|
+
template binary. Read it before you configure the plugin.
|
|
93
|
+
|
|
94
|
+
A feature no plugin covers can be a local plugin in
|
|
95
|
+
`src/plugins/<name>/index.js`; see the tutorial
|
|
96
|
+
[Write a local plugin](https://nera.js.org/tutorials/write-a-local-plugin.md).
|
|
97
|
+
|
|
98
|
+
## Recipes
|
|
99
|
+
|
|
100
|
+
Short task guides. Each names the steps, the files it touches and the docs
|
|
101
|
+
page to open next.
|
|
102
|
+
|
|
103
|
+
- [Business site](recipes/business-site.md): home, about, services, contact,
|
|
104
|
+
imprint and privacy, with a menu
|
|
105
|
+
- [Blog](recipes/blog.md): posts, a post list, tags, pagination, sitemap
|
|
106
|
+
- [Portfolio](recipes/portfolio.md): project pages with responsive images
|
|
107
|
+
- [Contact form](recipes/contact-form.md): a `mailto:` form, no backend
|
|
108
|
+
- [Search](recipes/search.md): client-side search over the site
|
|
109
|
+
- [Images](recipes/images.md): responsive AVIF/WebP images
|
|
110
|
+
- [Multilingual site](recipes/multilingual.md): a second language
|
|
111
|
+
- [Custom domain](recipes/custom-domain.md): DNS, GitHub Pages
|
|
112
|
+
`--domain`, `base_path`
|
|
113
|
+
|
|
114
|
+
## Docs
|
|
115
|
+
|
|
116
|
+
The docs on https://nera.js.org are the truth; this skill only points to
|
|
117
|
+
them. For AI assistants, in English:
|
|
118
|
+
|
|
119
|
+
- Index: https://nera.js.org/llms.txt
|
|
120
|
+
- Everything in one file: https://nera.js.org/llms-full.txt
|
|
121
|
+
- Single pages as Markdown:
|
|
122
|
+
[getting started](https://nera.js.org/docs/getting-started.md),
|
|
123
|
+
[core concepts](https://nera.js.org/docs/core-concepts.md),
|
|
124
|
+
[writing content](https://nera.js.org/docs/writing-content.md),
|
|
125
|
+
[plugins](https://nera.js.org/docs/plugins.md),
|
|
126
|
+
[deployment](https://nera.js.org/docs/deployment.md),
|
|
127
|
+
[CLI](https://nera.js.org/docs/cli.md),
|
|
128
|
+
[using AI](https://nera.js.org/docs/using-ai.md)
|
|
129
|
+
- Tutorials: [build a blog](https://nera.js.org/tutorials/build-a-blog.md),
|
|
130
|
+
[custom navigation](https://nera.js.org/tutorials/custom-navigation.md),
|
|
131
|
+
[tag your content](https://nera.js.org/tutorials/tag-your-content.md),
|
|
132
|
+
[add search](https://nera.js.org/tutorials/add-search.md),
|
|
133
|
+
[prev/next pagination](https://nera.js.org/tutorials/prev-next-pagination.md),
|
|
134
|
+
[canonical links](https://nera.js.org/tutorials/canonical-links-seo.md),
|
|
135
|
+
[how nera.js.org is built](https://nera.js.org/tutorials/how-this-site-is-built.md)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Recipe: blog
|
|
2
|
+
|
|
3
|
+
Posts in a folder, a list of posts on the home page, tags, previous/next
|
|
4
|
+
links and a sitemap.
|
|
5
|
+
|
|
6
|
+
## Fast path
|
|
7
|
+
|
|
8
|
+
`npx @nera-static/nera new my-blog --starter blog` creates a blog on
|
|
9
|
+
`@nera-static/theme-blog`: sample posts, tags, an archive by year,
|
|
10
|
+
previous/next, an Atom feed, a sitemap and navigation. The theme's own
|
|
11
|
+
templates list the posts; it does not use simple-page-list. Read its
|
|
12
|
+
`AGENTS.md`, then replace the sample posts and the placeholder
|
|
13
|
+
`origin: https://example.com` in `config/app.yaml` with the live URL; step 9
|
|
14
|
+
below still applies. The steps below build the blog by hand instead, with
|
|
15
|
+
different files.
|
|
16
|
+
|
|
17
|
+
## Steps
|
|
18
|
+
|
|
19
|
+
1. Scaffold: `npx @nera-static/nera new my-blog`, then read its `AGENTS.md`.
|
|
20
|
+
2. One Markdown file per post in `pages/posts/`, e.g.
|
|
21
|
+
`pages/posts/first-post.md`, each with `layout`, `title`, `description`,
|
|
22
|
+
`date` (`2026-10-12`) and `tags` (`tags: travel, food` or a YAML list).
|
|
23
|
+
A post is served at `/posts/first-post.html`.
|
|
24
|
+
3. Post list: `npm install @nera-static/plugin-simple-page-list`, set
|
|
25
|
+
`page_path: /posts`, `sortBy: date` and `sortOrder: descending` in
|
|
26
|
+
`config/simple-page-list.yaml`, run
|
|
27
|
+
`npx nera-simple-page-list`, and include the list in the template of the
|
|
28
|
+
home page (data: `app.pageList`).
|
|
29
|
+
4. Tags: `npm install @nera-static/plugin-tags`. It builds a page per tag
|
|
30
|
+
at `/tags/<tag>.html`. Run `npx nera-tags` and include
|
|
31
|
+
`partials/tag-links` in the post template and `partials/tag-cloud` where
|
|
32
|
+
you want all tags.
|
|
33
|
+
5. Previous/next: `npm install @nera-static/plugin-page-pagination`, give
|
|
34
|
+
each post a `pagination_order` number, run `npx nera-page-pagination`
|
|
35
|
+
and include it in the post template. It links pages of the same folder.
|
|
36
|
+
6. A post template of its own: `theme/views/pages/post.pug`, extending
|
|
37
|
+
`../layouts/layout` like `pages/default.pug`, with exactly one `main`.
|
|
38
|
+
Posts then use `layout: pages/post.pug`.
|
|
39
|
+
7. Sitemap: `npm install @nera-static/plugin-sitemap` and set `origin` in
|
|
40
|
+
`config/app.yaml`. It also writes `robots.txt`.
|
|
41
|
+
8. Menu: `@nera-static/plugin-navigation`, as in
|
|
42
|
+
[business-site](business-site.md).
|
|
43
|
+
9. `npx nera validate`, then `npx nera build --check`; fix what they report.
|
|
44
|
+
|
|
45
|
+
Each plugin's README names its config keys and include paths; read it
|
|
46
|
+
before step 3, 4 or 5.
|
|
47
|
+
|
|
48
|
+
## Files touched
|
|
49
|
+
|
|
50
|
+
`pages/posts/*.md`, `pages/index.md`, `config/app.yaml`,
|
|
51
|
+
`config/simple-page-list.yaml`, `config/tags.yaml` (optional),
|
|
52
|
+
`theme/views/pages/post.pug`, `theme/views/vendor/plugin-*/`,
|
|
53
|
+
`package.json`.
|
|
54
|
+
|
|
55
|
+
## Read next
|
|
56
|
+
|
|
57
|
+
- https://nera.js.org/tutorials/build-a-blog.md
|
|
58
|
+
- https://nera.js.org/tutorials/tag-your-content.md
|
|
59
|
+
- https://nera.js.org/tutorials/prev-next-pagination.md
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Recipe: business site
|
|
2
|
+
|
|
3
|
+
A small business presence: home, about, services, opening hours, contact,
|
|
4
|
+
imprint and privacy, with a menu on every page.
|
|
5
|
+
|
|
6
|
+
## Fast path
|
|
7
|
+
|
|
8
|
+
`npx @nera-static/nera new my-business --starter business` creates all of
|
|
9
|
+
this on `@nera-static/theme-business`: the pages, navigation, a contact form,
|
|
10
|
+
responsive images, social links and a sitemap. Read its `AGENTS.md`, then
|
|
11
|
+
replace the sample texts; steps 2, 8 and 9 below still apply. The steps
|
|
12
|
+
below build the site by hand instead, with different files.
|
|
13
|
+
|
|
14
|
+
## Steps
|
|
15
|
+
|
|
16
|
+
1. Scaffold: `npx @nera-static/nera new my-business`, then read its
|
|
17
|
+
`AGENTS.md`.
|
|
18
|
+
2. Set the site in `config/app.yaml`: `name`, `lang`, and `origin` (the
|
|
19
|
+
live URL, e.g. `https://example.com`) once the domain is known.
|
|
20
|
+
3. Write one Markdown page per topic, each with `layout: pages/default.pug`,
|
|
21
|
+
a `title` and a `description`: `pages/index.md`, `pages/about.md`,
|
|
22
|
+
`pages/services.md`, `pages/opening-hours.md`, `pages/contact.md`.
|
|
23
|
+
Opening hours fit a Markdown table. A new site already has
|
|
24
|
+
`pages/imprint.md` and `pages/privacy.md` as placeholders, linked from
|
|
25
|
+
the layout's footer: replace their text, or write them if they are
|
|
26
|
+
missing.
|
|
27
|
+
4. Menu: `npm install @nera-static/plugin-navigation`, list the pages in
|
|
28
|
+
`config/navigation.yaml` (`href` ending in `.html`, `name`; groups such
|
|
29
|
+
as `main:` and `footer:`; a footer menu replaces the layout's own
|
|
30
|
+
imprint and privacy links, so keep only one of the two), run
|
|
31
|
+
`npx nera-navigation` and include a menu in
|
|
32
|
+
`theme/views/layouts/layout.pug` (see the plugin README for the mixins).
|
|
33
|
+
5. Contact form: follow [contact-form](contact-form.md).
|
|
34
|
+
6. Optional, for search engines: `@nera-static/plugin-sitemap` (needs
|
|
35
|
+
`origin`) and `@nera-static/plugin-canonical-links`. Social profiles:
|
|
36
|
+
`@nera-static/plugin-social-media-links`.
|
|
37
|
+
7. Styles: a CSS file in `theme/assets/css/`, linked from the layout's
|
|
38
|
+
`head` (`link(rel="stylesheet" href="/css/main.css")`).
|
|
39
|
+
8. `npx nera validate`, then `npx nera build --check`; fix what they report.
|
|
40
|
+
The legal hints from the check matter here: a business site usually
|
|
41
|
+
needs an imprint and a privacy page.
|
|
42
|
+
9. Deploy `public/` (see [custom-domain](custom-domain.md)).
|
|
43
|
+
|
|
44
|
+
Mark invented details (address, hours, prices, legal texts) as placeholders
|
|
45
|
+
for the owner to replace, and say that legal pages need checking.
|
|
46
|
+
|
|
47
|
+
## Files touched
|
|
48
|
+
|
|
49
|
+
`config/app.yaml`, `config/navigation.yaml`, `pages/*.md`,
|
|
50
|
+
`theme/views/layouts/layout.pug`, `theme/views/vendor/plugin-navigation/`,
|
|
51
|
+
`theme/assets/css/`, `package.json`.
|
|
52
|
+
|
|
53
|
+
## Read next
|
|
54
|
+
|
|
55
|
+
- https://nera.js.org/docs/writing-content.md
|
|
56
|
+
- https://nera.js.org/tutorials/custom-navigation.md
|
|
57
|
+
- https://nera.js.org/docs/deployment.md
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Recipe: contact form
|
|
2
|
+
|
|
3
|
+
A contact form with `@nera-static/plugin-contact-form`. It opens the
|
|
4
|
+
visitor's mail client (`mailto:`): no backend, no form service, no account.
|
|
5
|
+
Do not hand-write a `<form>` or post to a third-party service.
|
|
6
|
+
|
|
7
|
+
## Steps
|
|
8
|
+
|
|
9
|
+
1. `npm install @nera-static/plugin-contact-form`
|
|
10
|
+
2. Create `config/contact-form.yaml`. `recipient` and at least one field
|
|
11
|
+
are required; without them the form does not render and the build only
|
|
12
|
+
warns:
|
|
13
|
+
|
|
14
|
+
```yaml
|
|
15
|
+
recipient: hello@example.com
|
|
16
|
+
fields:
|
|
17
|
+
- name: name
|
|
18
|
+
label: Your name
|
|
19
|
+
type: text
|
|
20
|
+
required: true
|
|
21
|
+
- name: email
|
|
22
|
+
label: Your email
|
|
23
|
+
type: email
|
|
24
|
+
required: true
|
|
25
|
+
- name: message
|
|
26
|
+
label: Message
|
|
27
|
+
type: textarea
|
|
28
|
+
required: true
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Field types: `text`, `email`, `tel`, `textarea`, `select`, `checkbox`,
|
|
32
|
+
`radio`. The README lists the optional keys (subject, labels, honeypot,
|
|
33
|
+
`consent_text` with a link to the privacy page).
|
|
34
|
+
3. `npx nera-contact-form` copies the form to
|
|
35
|
+
`theme/views/vendor/plugin-contact-form/` and its script to
|
|
36
|
+
`theme/assets/js/contact-form.js`.
|
|
37
|
+
4. A page template for the contact page, `theme/views/pages/contact.pug`:
|
|
38
|
+
|
|
39
|
+
```pug
|
|
40
|
+
extends ../layouts/layout
|
|
41
|
+
|
|
42
|
+
block content
|
|
43
|
+
main
|
|
44
|
+
| !{ content }
|
|
45
|
+
include /vendor/plugin-contact-form/contact-form
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
5. `pages/contact.md` with `layout: pages/contact.pug`, a `title` and a
|
|
49
|
+
short text above the form.
|
|
50
|
+
6. `npx nera validate`, then `npx nera build --check`. Open
|
|
51
|
+
`/contact.html` with `npm run dev` and submit once: the mail client
|
|
52
|
+
should open with the message filled in.
|
|
53
|
+
|
|
54
|
+
## Files touched
|
|
55
|
+
|
|
56
|
+
`package.json`, `config/contact-form.yaml`, `pages/contact.md`,
|
|
57
|
+
`theme/views/pages/contact.pug`, `theme/views/vendor/plugin-contact-form/`,
|
|
58
|
+
`theme/assets/js/contact-form.js`.
|
|
59
|
+
|
|
60
|
+
## Read next
|
|
61
|
+
|
|
62
|
+
- Plugin README: https://github.com/seebaermichi/nera-plugin-contact-form
|
|
63
|
+
- https://nera.js.org/docs/plugins.md
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Recipe: custom domain
|
|
2
|
+
|
|
3
|
+
Serve the built site under a domain of your own. Nera builds static files;
|
|
4
|
+
the domain is set at the host and at the domain registrar.
|
|
5
|
+
|
|
6
|
+
## Steps
|
|
7
|
+
|
|
8
|
+
1. Build: `npm run build`. Deploy the contents of `public/` to the host
|
|
9
|
+
(GitHub Pages, Netlify, any static host). Set the host to build with
|
|
10
|
+
`npm run build` and publish `public/`, or upload `public/` yourself.
|
|
11
|
+
2. At the host, add the custom domain in its site settings.
|
|
12
|
+
3. At the registrar, set the DNS records the host names for that domain,
|
|
13
|
+
usually a `CNAME` record for `www` pointing at the host and `A`/`AAAA`
|
|
14
|
+
records (or `ALIAS`) for the bare domain. Copy them from the host's own
|
|
15
|
+
docs; they differ per host. DNS can take hours to spread.
|
|
16
|
+
4. **GitHub Pages through `nera publish`:** run
|
|
17
|
+
`npx nera publish --yes --domain www.example.com`. It sets the domain in
|
|
18
|
+
the Pages settings, removes `base_path`, checks the DNS on every publish
|
|
19
|
+
and prints the records to set when they are missing (`A`/`AAAA` for a
|
|
20
|
+
bare domain, a `CNAME` to `<user>.github.io` otherwise). Steps 2 and 5 are done for you; set
|
|
21
|
+
the records of step 3 yourself.
|
|
22
|
+
No `CNAME` file is needed: GitHub ignores it for a site an Actions
|
|
23
|
+
workflow deploys. Only a Pages site deployed from a branch uses one; put
|
|
24
|
+
it in `theme/assets/CNAME` (never in `public/`, which every build deletes).
|
|
25
|
+
**Netlify through `nera publish`:** run
|
|
26
|
+
`npx nera publish --yes --target netlify --domain www.example.com`. It sets
|
|
27
|
+
the domain on the Netlify site, checks the DNS on every publish and prints
|
|
28
|
+
the records to set when they are missing (`A 75.2.60.5` for a bare
|
|
29
|
+
domain, a `CNAME` to `<site>.netlify.app` otherwise). Netlify issues the
|
|
30
|
+
HTTPS certificate by itself once the records point to it, so steps 2, 5
|
|
31
|
+
and 7 are done for you; set the records of step 3 yourself.
|
|
32
|
+
5. **`base_path`:** leave it unset for a custom domain or any site served
|
|
33
|
+
from the root. Set `base_path: /<repo>` in `config/app.yaml` only for a
|
|
34
|
+
site served under a sub-path, such as a GitHub project page at
|
|
35
|
+
`https://<user>.github.io/<repo>/`; Nera then prefixes every root-absolute
|
|
36
|
+
link and asset URL. Remove it again when the custom domain takes over.
|
|
37
|
+
6. Set `origin: https://www.example.com` in `config/app.yaml`, so the
|
|
38
|
+
sitemap and canonical links use the real domain.
|
|
39
|
+
7. Turn on HTTPS at the host once the domain resolves.
|
|
40
|
+
8. `npx nera validate`, then `npx nera build --check`, then deploy again.
|
|
41
|
+
|
|
42
|
+
## Files touched
|
|
43
|
+
|
|
44
|
+
`config/app.yaml` (`origin`, `base_path`), DNS settings outside the site,
|
|
45
|
+
`theme/assets/CNAME` only for a Pages site deployed from a branch.
|
|
46
|
+
|
|
47
|
+
## Read next
|
|
48
|
+
|
|
49
|
+
- https://nera.js.org/docs/deployment.md
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Recipe: images
|
|
2
|
+
|
|
3
|
+
Responsive images with `@nera-static/plugin-images`: each picture becomes a
|
|
4
|
+
`<picture>` with AVIF and WebP in several widths, plus a fallback. Needs
|
|
5
|
+
`@nera-static/core` 4.13.0 or later (`npx nera update` brings it).
|
|
6
|
+
|
|
7
|
+
## Steps
|
|
8
|
+
|
|
9
|
+
1. `npm install @nera-static/plugin-images`
|
|
10
|
+
2. Put the originals in the assets folder, e.g. `theme/assets/images/`.
|
|
11
|
+
They are referenced without `theme/assets`: `/images/photo.jpg`.
|
|
12
|
+
3. In Markdown, write images as usual; the plugin rewrites them:
|
|
13
|
+
``. A title becomes a caption
|
|
14
|
+
(``), and query parameters crop or
|
|
15
|
+
size one image (`?w=800&ratio=16:9`, see the README).
|
|
16
|
+
4. In frontmatter, `image: /images/hero.jpg` gets precomputed variants for
|
|
17
|
+
templates. Run `npx nera-images` to copy the `picture` mixin to
|
|
18
|
+
`theme/views/vendor/plugin-images/`, then in a template:
|
|
19
|
+
|
|
20
|
+
```pug
|
|
21
|
+
include /vendor/plugin-images/picture
|
|
22
|
+
+picture(meta.images && meta.images.image, { alt: meta.image_alt })
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Images written directly in Pug (`img(src=…)`) are not processed.
|
|
26
|
+
5. Optional `config/images.yaml`: `formats`, `widths`, `sizes`, `quality`.
|
|
27
|
+
6. Variants are cached in `.nera-cache/images/`; the scaffold's
|
|
28
|
+
`.gitignore` already ignores `.nera-cache`.
|
|
29
|
+
7. Originals with location data? List their folder (e.g. `images`) in a
|
|
30
|
+
`.neraignore` file at the site root; its paths are relative to the
|
|
31
|
+
assets folder. Only the processed variants, without metadata, are then
|
|
32
|
+
published.
|
|
33
|
+
8. `npx nera validate`, then `npx nera build --check`; every image needs
|
|
34
|
+
alt text.
|
|
35
|
+
|
|
36
|
+
## Files touched
|
|
37
|
+
|
|
38
|
+
`package.json`, `theme/assets/images/`, `pages/*.md`,
|
|
39
|
+
`config/images.yaml` (optional), `theme/views/vendor/plugin-images/`,
|
|
40
|
+
`.neraignore` (optional).
|
|
41
|
+
|
|
42
|
+
## Read next
|
|
43
|
+
|
|
44
|
+
- Plugin README: https://github.com/seebaermichi/nera-plugin-images
|
|
45
|
+
- https://nera.js.org/docs/writing-content.md
|