thincms_create_post
Create blog posts with HTML content and auto-created tags. Schedule publication as immediate or future dates.
Instructions
Create a blog post. Content should be raw HTML. Tags are auto-created if they don't exist. For large content (>10KB), use contentFile instead of content. Posts with status="published" and a publishedAt in the past appear on the public site immediately; a future publishedAt is auto-scheduling — they appear when the timestamp passes (no worker required, the public site filters by date). Posts with status="draft" never appear publicly regardless of dates. Use scheduledFor="immediate" to publish now, or scheduledFor=<ISO timestamp at least 60 min in the future> to schedule.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | No | URL slug (auto-generated from title if omitted) | |
| tags | No | Array of tag names (auto-created if new) | |
| title | Yes | Post title (required) | |
| jsonLd | No | Custom JSON-LD (Schema.org) injected verbatim into the post <head>. Pass valid JSON as a string. Use for HowTo, Recipe, Event, etc. (Article + BreadcrumbList are auto-emitted.) Set to empty string to clear. | |
| series | No | Series name for multi-part content | |
| siteId | No | Override the active site for this single call. Pass to target a specific tenant without mutating shared active-site state — the right pattern when running concurrent agent sessions managing different tenants. Must match a siteId from your THINCMS_SITES config (use thincms_list_sites to inspect). When omitted, the call uses the active site set by thincms_switch_site. | |
| status | No | Post status (default: draft) | |
| content | No | HTML content of the post | |
| excerpt | No | Short summary/excerpt | |
| noIndex | No | Exclude this post from search engine indexing (default: false) | |
| authorId | No | Author ID | |
| featured | No | Mark as featured post | |
| metaTitle | No | SEO meta title | |
| ogImageUrl | No | Open Graph image URL | |
| categoryIds | No | Array of category IDs | |
| contentFile | No | Local file path containing HTML content — use this instead of content for large posts (>10KB). The file is read and sent as content. | |
| gatePreview | No | Custom HTML teaser shown before the gate. If omitted, the excerpt or first 2 paragraphs are used. | |
| pinnedUntil | No | ISO date: pin post until this date | |
| publishedAt | No | DEPRECATED — use scheduledFor. ISO date for publication date. | |
| scheduledAt | No | DEPRECATED — use scheduledFor. Legacy field, no longer affects visibility. | |
| seriesOrder | No | Order within series | |
| canonicalUrl | No | Canonical URL | |
| scheduledFor | No | When the post should become public. Pass "immediate" to publish now, or an ISO 8601 timestamp at least 60 minutes in the future to schedule. Required at status="published" — Phase 3 will reject omission. Posts with status="draft" ignore this field. | |
| gatedFormSlug | No | Form slug to gate this post behind. Visitors must submit the form to see full content. Set to empty string to remove gating. | |
| membersContent | No | HTML content visible only to authenticated members/subscribers. Shown after the main content for logged-in members. | |
| metaDescription | No | SEO meta description | |
| confirmProductionWrite | No | Acknowledge that this call may write to a configured production site (THINCMS_PRODUCTION_SITE_IDS env var). Required for any POST/PUT/PATCH/DELETE against a production-listed site; ignored otherwise. The error message lists which site triggered the requirement and recommends thincms_snapshot before any production write. |