Operazioni sugli articoli
4 operazioni di nome article.*. Ognuna si esegue in un batch con apply_ops, dry_run_ops, la CLI o l’admin.
| Operation | What it does | Permission | Confirmation |
|---|---|---|---|
| article.create | Create a draft article under a blog index (blogId, the blog index page id) from its title, an optional slug and templateId, the article template it renders with. | site.edit | none |
| article.update | Patch an article as { id, patch }: its slug, title, excerpt, featured image, author, canonical URL, SEO (seo.metaTitle, metaDescription, ogImageId, noIndex), template or members-only access. | site.edit | none |
| article.publish | Put an article and its current content on the public site on their own, at once, without a site publish: its status becomes published and its first publication date is set the first time. | site.edit | publish |
| article.unpublish | Take an article off the public site at once: it becomes a draft again and keeps its first publication date for a later article.publish. | site.edit | publish |
article.create
Create a draft article under a blog index (blogId, the blog index page id) from its title, an optional slug and templateId, the article template it renders with. Its content is its tree: fill it with tree.commit on the answered id; it stays off the public site until article.publish. Entry validation (page type, template, slug) and ownership checks apply.
Esempio di input
{
"title": "A house on the hill",
"templateId": "article-gallery-sticky",
"blogId": "5f6a7b8c-9d0e-4f1a-8b2c-3d4e5f6a7b8c"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| title | string | yes | At least 1 character. At most 200 characters. |
| slug | string | no | |
| templateId | string | yes | At least 1 character. |
| locale | string | no | At least 1 character. Default "en-US". |
| blogId | string (uuid) | yes |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| id | string | yes | |
| slug | string | yes | |
| templateId | string | yes | |
| blogId | string | no |
Provala
yarn splash article.create '{"title":"A house on the hill","templateId":"article-gallery-sticky","blogId":"5f6a7b8c-9d0e-4f1a-8b2c-3d4e5f6a7b8c"}' --dry-runarticle.update
Patch an article as { id, patch }: its slug, title, excerpt, featured image, author, canonical URL, SEO (seo.metaTitle, metaDescription, ogImageId, noIndex), template or members-only access. Its content is its tree. Entry validation (page type, template, slug) and ownership checks apply.
Esempio di input
{
"id": "4e5f6a7b-8c9d-4e0f-9a1b-2c3d4e5f6a7b",
"patch": {
"title": {
"en-US": "A house on the hill"
},
"excerpt": {
"en-US": "Notes from the site."
}
}
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| id | string | yes | At least 1 character. |
| patch | object | yes | |
| patch.slug | string | no | |
| patch.title | record of string | no | |
| patch.excerpt | record of string | null | no | |
| patch.featuredImageId | string | null | no | |
| patch.authorUserId | string | null | no | |
| patch.authorName | string | null | no | |
| patch.canonicalUrl | string | null | no | |
| patch.seo | object | no | |
| patch.templateId | string | no | At least 1 character. |
| patch.requireAuth | boolean | no | |
| patch.requiredRoles | array of string | no | At most 50 items. |
{
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1
},
"patch": {
"type": "object",
"properties": {
"slug": {
"type": "string"
},
"title": {
"$ref": "#/$defs/__schema0"
},
"excerpt": {
"anyOf": [
{
"$ref": "#/$defs/__schema0"
},
{
"type": "null"
}
]
},
"featuredImageId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"authorUserId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"authorName": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"canonicalUrl": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"seo": {
"type": "object",
"properties": {
"metaTitle": {
"anyOf": [
{
"$ref": "#/$defs/__schema0"
},
{
"type": "null"
}
]
},
"metaDescription": {
"anyOf": [
{
"$ref": "#/$defs/__schema0"
},
{
"type": "null"
}
]
},
"ogImageId": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"noIndex": {
"type": "boolean"
}
},
"additionalProperties": false
},
"templateId": {
"type": "string",
"minLength": 1
},
"requireAuth": {
"type": "boolean"
},
"requiredRoles": {
"maxItems": 50,
"type": "array",
"items": {
"$ref": "#/$defs/__schema1"
}
}
},
"additionalProperties": false
}
},
"required": [
"id",
"patch"
],
"additionalProperties": false,
"$defs": {
"__schema0": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "string"
}
},
"__schema1": {
"type": "string",
"maxLength": 40,
"pattern": "^[a-z][a-z0-9-]*$"
}
}
}Output
| Field | Type | Required | Notes |
|---|---|---|---|
| id | string | yes | At least 1 character. |
Provala
yarn splash article.update '{"id":"4e5f6a7b-8c9d-4e0f-9a1b-2c3d4e5f6a7b","patch":{"title":{"en-US":"A house on the hill"},"excerpt":{"en-US":"Notes from the site."}}}' --dry-runarticle.publish
Put an article and its current content on the public site on their own, at once, without a site publish: its status becomes published and its first publication date is set the first time. Entry validation (page type, template, slug) and ownership checks apply.
Esempio di input
{
"id": "4e5f6a7b-8c9d-4e0f-9a1b-2c3d4e5f6a7b"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| id | string | yes | At least 1 character. |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| ok | true | yes |
La pubblicazione non si può provare in un dry run, e la forma della CLI per una sola operazione non imposta conferme: mettila in un batch con confirmed: ["publish"] ed esegui yarn splash apply <file>.
article.unpublish
Take an article off the public site at once: it becomes a draft again and keeps its first publication date for a later article.publish. Entry validation (page type, template, slug) and ownership checks apply.
Esempio di input
{
"id": "4e5f6a7b-8c9d-4e0f-9a1b-2c3d4e5f6a7b"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| id | string | yes | At least 1 character. |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| ok | true | yes |
La pubblicazione non si può provare in un dry run, e la forma della CLI per una sola operazione non imposta conferme: mettila in un batch con confirmed: ["publish"] ed esegui yarn splash apply <file>.
Generato dal registro delle operazioni e dal catalogo degli strumenti MCP (sorgente c677665ced643454).
Qualcosa non va in questa pagina? Scrivi a docs@librettocms.com.