Navigation operations
5 operations named navigation.*. Every one runs in a batch through apply_ops, dry_run_ops, the CLI or the admin.
| Operation | What it does | Permission | Confirmation |
|---|---|---|---|
| navigation.read | Read the draft menus of the site and their revision. | site.read | none |
| navigation.anchors | List what an anchor target may point at: each page with the anchors of its own tree, then the header and footer anchors every page shows, marked with their region. | site.read | none |
| navigation.upsert | Write a whole menu, replacing the menu with its key or adding it after the others. | site.edit | none |
| navigation.delete | Delete a menu; a menu prop that names it then draws nothing. | site.edit | destructive |
| navigation.reorder | Reorder the items of a menu: itemIds names each item once, in the new order. | site.edit | none |
navigation.read
Read the draft menus of the site and their revision. A page or anchor target names its page by id. Menus are versioned with the site: publish copies them, and the public site serves the published ones.
Example input
{}Input
The input is a record; see the schema below.
{
"type": "object",
"properties": {},
"additionalProperties": false
}Output
| Field | Type | Required | Notes |
|---|---|---|---|
| navigation | object | yes | |
| navigation.revision | integer | yes | At least 0. |
| navigation.menus | array of object | yes |
Fields nested deeper are in the output schema that discover_operations answers with outputSchemas: true.
Try it
yarn splash navigation.read '{}' --dry-runnavigation.anchors
List what an anchor target may point at: each page with the anchors of its own tree, then the header and footer anchors every page shows, marked with their region. Each anchor is labelled with its first heading. Menus are versioned with the site: publish copies them, and the public site serves the published ones.
Example input
{}Input
The input is a record; see the schema below.
{
"type": "object",
"properties": {},
"additionalProperties": false
}Output
| Field | Type | Required | Notes |
|---|
Try it
yarn splash navigation.anchors '{}' --dry-runnavigation.upsert
Write a whole menu, replacing the menu with its key or adding it after the others. A page or anchor target must name a page of the site; an anchor no section carries yet is a finding, not a refusal. An anchor of the header or footer (navigation.anchors marks it with its region) is shown by every page: target it as { kind: "anchor", pageId: <the home page id>, anchor: <the region anchor> }, never with the region's own page id, which is not a page of the site. Menus are versioned with the site: publish copies them, and the public site serves the published ones.
Example input
{
"menu": {
"key": "main",
"label": "Main menu",
"items": [
{
"id": "item0001",
"label": {
"it": "Il progetto",
"en": "The project"
},
"target": {
"kind": "anchor",
"pageId": "6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f",
"anchor": "progetto"
}
},
{
"id": "item0002",
"label": "Studio",
"target": {
"kind": "page",
"pageId": "6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f"
}
},
{
"id": "item0003",
"label": "Instagram",
"target": {
"kind": "external",
"href": "https://www.instagram.com/studio"
}
},
{
"id": "item0004",
"label": "Languages",
"target": {
"kind": "languages"
}
},
{
"id": "item0005",
"label": {
"it": "Contatti",
"en": "Contact"
},
"target": {
"kind": "anchor",
"pageId": "6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f",
"anchor": "contatti"
}
}
]
}
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| menu | object | yes | |
| menu.key | string | yes | At most 40 characters. |
| menu.label | string | yes | At least 1 character. At most 80 characters. |
| menu.items | array of object | yes | At most 24 items. |
{
"type": "object",
"properties": {
"menu": {
"type": "object",
"properties": {
"key": {
"type": "string",
"maxLength": 40,
"pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
},
"label": {
"type": "string",
"minLength": 1,
"maxLength": 80
},
"items": {
"maxItems": 24,
"type": "array",
"items": {
"$ref": "#/$defs/__schema0"
}
}
},
"required": [
"key",
"label",
"items"
],
"additionalProperties": false
}
},
"required": [
"menu"
],
"additionalProperties": false,
"$defs": {
"__schema0": {
"type": "object",
"properties": {
"id": {
"$ref": "#/$defs/__schema1"
},
"label": {
"$ref": "#/$defs/__schema2"
},
"target": {
"$ref": "#/$defs/__schema5"
},
"children": {
"maxItems": 40,
"type": "array",
"items": {
"$ref": "#/$defs/__schema8"
}
}
},
"required": [
"id",
"label",
"target"
],
"additionalProperties": false
},
"__schema1": {
"type": "string",
"pattern": "^[0-9a-z]{8}$"
},
"__schema2": {
"anyOf": [
{
"$ref": "#/$defs/__schema3"
},
{
"type": "object",
"propertyNames": {
"$ref": "#/$defs/__schema4"
},
"additionalProperties": {
"$ref": "#/$defs/__schema3"
}
}
]
},
"__schema3": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"__schema4": {
"type": "string",
"pattern": "^[a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-(?:[A-Z]{2}|\\d{3}))?$"
},
"__schema5": {
"oneOf": [
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "page"
},
"pageId": {
"$ref": "#/$defs/__schema6"
}
},
"required": [
"kind",
"pageId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "anchor"
},
"pageId": {
"$ref": "#/$defs/__schema6"
},
"anchor": {
"type": "string",
"pattern": "^[a-z][a-z0-9-]{0,63}$"
}
},
"required": [
"kind",
"pageId",
"anchor"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "external"
},
"href": {
"anyOf": [
{
"$ref": "#/$defs/__schema7"
},
{
"type": "object",
"propertyNames": {
"$ref": "#/$defs/__schema4"
},
"additionalProperties": {
"$ref": "#/$defs/__schema7"
}
}
]
}
},
"required": [
"kind",
"href"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "languages"
}
},
"required": [
"kind"
],
"additionalProperties": false
}
]
},
"__schema6": {
"type": "string",
"minLength": 1,
"maxLength": 36
},
"__schema7": {
"type": "string",
"maxLength": 2048,
"pattern": "^(?:https?:\\/\\/|mailto:|tel:|\\/(?!\\/))"
},
"__schema8": {
"type": "object",
"properties": {
"id": {
"$ref": "#/$defs/__schema1"
},
"label": {
"$ref": "#/$defs/__schema2"
},
"target": {
"$ref": "#/$defs/__schema5"
},
"group": {
"anyOf": [
{
"$ref": "#/$defs/__schema9"
},
{
"type": "object",
"propertyNames": {
"$ref": "#/$defs/__schema4"
},
"additionalProperties": {
"$ref": "#/$defs/__schema9"
}
}
]
}
},
"required": [
"id",
"label",
"target"
],
"additionalProperties": false
},
"__schema9": {
"type": "string",
"minLength": 1,
"maxLength": 40
}
}
}Output
| Field | Type | Required | Notes |
|---|---|---|---|
| navigation | object | yes | |
| navigation.revision | integer | yes | At least 0. |
| navigation.menus | array of object | yes |
Fields nested deeper are in the output schema that discover_operations answers with outputSchemas: true.
Try it
yarn splash navigation.upsert '{"menu":{"key":"main","label":"Main menu","items":[{"id":"item0001","label":{"it":"Il progetto","en":"The project"},"target":{"kind":"anchor","pageId":"6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f","anchor":"progetto"}},{"id":"item0002","label":"Studio","target":{"kind":"page","pageId":"6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f"}},{"id":"item0003","label":"Instagram","target":{"kind":"external","href":"https://www.instagram.com/studio"}},{"id":"item0004","label":"Languages","target":{"kind":"languages"}},{"id":"item0005","label":{"it":"Contatti","en":"Contact"},"target":{"kind":"anchor","pageId":"6f1d2c3b-4a59-4e8d-9c7b-1a2b3c4d5e6f","anchor":"contatti"}}]}}' --dry-runnavigation.delete
Delete a menu; a menu prop that names it then draws nothing. Menus are versioned with the site: publish copies them, and the public site serves the published ones.
Example input
{
"key": "footer-legal"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| key | string | yes | At most 40 characters. |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| navigation | object | yes | |
| navigation.revision | integer | yes | At least 0. |
| navigation.menus | array of object | yes |
Fields nested deeper are in the output schema that discover_operations answers with outputSchemas: true.
Needs confirmed: ["destructive"] on the batch, which the single-operation CLI form does not set: put it in a batch file and run yarn splash apply <file> --dry-run.
navigation.reorder
Reorder the items of a menu: itemIds names each item once, in the new order. Menus are versioned with the site: publish copies them, and the public site serves the published ones.
Example input
{
"key": "main",
"itemIds": [
"item0002",
"item0001",
"item0003",
"item0004",
"item0005"
]
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| key | string | yes | At most 40 characters. |
| itemIds | array of string | yes | At least 1 item. |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| navigation | object | yes | |
| navigation.revision | integer | yes | At least 0. |
| navigation.menus | array of object | yes |
Fields nested deeper are in the output schema that discover_operations answers with outputSchemas: true.
Try it
yarn splash navigation.reorder '{"key":"main","itemIds":["item0002","item0001","item0003","item0004","item0005"]}' --dry-runGenerated from the operation registry and the MCP tool catalogue (source 5103a4e633cefa1c).
Something wrong on this page? Write to docs@librettocms.com.