Operazioni sulla navigazione
5 operazioni di nome navigation.*. Ognuna si esegue in un batch con apply_ops, dry_run_ops, la CLI o l’admin.
| Operation | What it does | Permission | Confirmation |
|---|---|---|---|
| navigation.read | Read the draft menus of the site and their revision: each menu with its key (what the menu prop of a nav list, a menu dialog's list or the footer names), its label and its items. | 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: each menu with its key (what the menu prop of a nav list, a menu dialog's list or the footer names), its label and its items. An item has an id, a translatable label and a target of kind page { pageId }, anchor { pageId, anchor }, external { href } (an absolute, mail or phone link) or languages (one link per site locale); a top-level item may hold one level of children, and a child's group titles its column. 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.
Esempio di input
{}Input
L’input è un record: vedi lo schema qui sotto.
{
"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 |
I campi più annidati sono nello schema di output che risponde discover_operations con outputSchemas: true.
Provala
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.
Esempio di input
{}Input
L’input è un record: vedi lo schema qui sotto.
{
"type": "object",
"properties": {},
"additionalProperties": false
}Output
| Field | Type | Required | Notes |
|---|
Provala
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.
Esempio di 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 |
I campi più annidati sono nello schema di output che risponde discover_operations con outputSchemas: true.
Provala
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.
Esempio di 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 |
I campi più annidati sono nello schema di output che risponde discover_operations con outputSchemas: true.
Vuole confirmed: ["destructive"] sul batch, che la forma della CLI per una sola operazione non imposta: mettila in un file di batch ed esegui 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.
Esempio di 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 |
I campi più annidati sono nello schema di output che risponde discover_operations con outputSchemas: true.
Provala
yarn splash navigation.reorder '{"key":"main","itemIds":["item0002","item0001","item0003","item0004","item0005"]}' --dry-runGenerato dal registro delle operazioni e dal catalogo degli strumenti MCP (sorgente 32867aaa66841a68).
Qualcosa non va in questa pagina? Scrivi a docs@librettocms.com.