Generated banner for Wix Headless
Generated logo for Wix Headless

Wix Headless

WixOfficialPublished by Wix

  • Skill
  • Tool integration
  • Software development
  • MIT
  • Low risk
  • Has scripts

From the author

Connect Wix business services (Stores, Bookings, Donations, CMS, Blog, Events, Forms, and more) to a Wix Headless frontend — infer the needed capabilities, install the apps, seed backend content, and produce an SDK-integration guide. For managed (Wix-hosted) projects it can also build the frontend: scaffold a new site (create) or wire an existing/brought-in design (connect), then build and release. Works across managed, self-managed, and stripe project types. Triggers: set up a Wix Headless backend, add Wix business features to my app, accept donations, build or host a Wix site, connect/implement this design with Wix.
— the description by Wix

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The wix-headless skill acts as an orchestrator for integrating Wix business services (such as Stores, Bookings, and CMS) into a headless frontend architecture. It handles the end-to-end configuration of the Wix backend, including app installation, content seeding, and the generation of a tailored SDK integration guide. Depending on the project type (managed, self-managed, or stripe), the skill can either provide a comprehensive integration guide for the user to implement or, in managed scenarios, actively scaffold, wire, and deploy the frontend project.

What it does

  • Infers required Wix capabilities based on user intent and project context.
  • Installs necessary Wix apps and seeds backend content automatically.
  • Generates a custom SDK integration guide for calling Wix services from the frontend.
  • Scaffolds or connects existing frontend projects to Wix for managed hosting.
  • Handles project-type-specific authentication and deployment workflows.
  • Provides a mechanism to relay feedback to Wix regarding the headless experience.

When to use it

  • When you need to integrate Wix business services into a custom-built headless frontend.
  • When you want to automate the setup and content seeding of a Wix backend.
  • When you are building a new site on Wix infrastructure and need a scaffolded frontend.
  • When you have an existing frontend design and need to wire it to Wix business capabilities.
  • When working with Stripe Projects and requiring a Wix backend configuration.

Advantages

  • Reduces manual configuration by automating app installation and content seeding.
  • Provides a clear, actionable SDK integration guide tailored to your specific capabilities.
  • Supports multiple project architectures including managed, self-managed, and Stripe-based setups.
  • Ensures consistent backend setup by following verified inline recipes.
  • Simplifies the transition from design to a functional, Wix-powered headless site.

Usage examples

“Set up a Wix Headless backend for a store with products and a blog.”
The skill will install the Stores and Blog apps, seed sample products and posts, and provide an SDK guide for fetching this data in your frontend.
“I have an existing design; connect it to Wix and host it on their managed infrastructure.”
The skill will initialize the project, wire the existing UI to the necessary Wix business services, and prepare it for release on Wix.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/wix/wix-headless/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip wix-headless.zip -d .agents/skills

Documentation by Wix

Wix Headless

This skill connects Wix business services to a Wix Headless frontend. Its core job is to configure the Wix backend: infer the needed capabilities, install the Wix apps, seed the backend content, and produce an SDK-integration guide describing how to call Wix from the frontend.

What happens with the frontend depends on the project type and operation:

  • Backend-only (self-managed, stripe, or a managed "just set up the backend" run) — the skill emits the SDK guide as its final output; the host owns the frontend, build, and hosting.

  • Managed create / connect — the skill also owns the frontend: it scaffolds a new project (create) or attaches Wix to an existing one (connect), wires it to the backend using that same guide, builds, and releases to Wix. (There is no Designer or template library — the frontend is built ad-hoc to intent.)

On a backend-only run the skill does not own the project scaffolding. When the work needs a frontend, scaffold it according to user intent — framework and structure follow the prompt; the skill's job is the Wix backend plus the emitted SDK guide describing how to call Wix from whatever frontend exists, not choosing or generating the app. This is the norm for a stripe run: the project is provisioned via Stripe Projects (credentials land in .env — see stripe/AUTHENTICATION.md), the skill configures the backend and emits the guide, and the live site is finalized per stripe/DEPLOYMENT.md — while the frontend is scaffolded and wired to intent, by the host.

Project types

The skill behaves identically across project types except for authentication and deployment, which are isolated in a per-type folder under references/:

Project typeHostingAuthentication & deployment live in
managedWix infrastructure (maintained by Wix)references/managed/
self-managedthe user's own host (TBD)references/self-managed/
stripethe user's own host, provisioned via Stripe Projectsreferences/stripe/

Everything else — Discovery, Setup, Seed, the SDK handoff — is project-type-agnostic and refers to "the provided authentication mechanism" rather than any specific method.

Resolving the project type

Resolve the type before Discovery, in this order — stop at the first that decides:

  1. Caller-provided. If the host/caller passed a project type (managed | self-managed | stripe), use it. An explicit value always wins.

  2. Detect from project signals (on disk). Check the working directory (read-only):

    • stripe — .env carries WIX_WIX_CLIENT_ID / WIX_WIX_CLIENT_SECRET / WIX_WIX_METASITE_ID (or the plain WIX_* fallback). This is the Stripe-Projects fingerprint.

    • managed — a Wix CLI project: wix.config.json present, or a .wix/ directory, or @wix/cli / @wix/astro in package.json.

    • self-managed — a frontend project on disk (e.g. package.json with a bundler/framework) with neither the Stripe .env fingerprint nor the Wix-CLI markers above.

  3. Detect from user intent. If disk is inconclusive, read the prompt:

    • managed — "managed", "host on Wix", "Wix-hosted", "deploy to Wix", "wix release".

    • stripe — "stripe projects", "I added Wix via Stripe", a Stripe-Projects context.

    • self-managed — "self-hosted", "my own host", names a non-Wix host, "I'll deploy it myself".

  4. Ask. If signals are absent or conflict, ask the user which type applies — don't guess.

Hold the resolved type in scratch; it selects <TYPE_DIR> (see Path resolution). Note self-managed is TBD — once resolved to it, the auth step will stop with a clear "not wired yet" error.

Resolving the operation (managed only)

create/connect/iterate are managed-only. For managed, resolve the operation by intent first, directory second — never let an empty directory override what the user is asking for. Check iterate first (it's decided by an unambiguous on-disk signal):

  • iterate → references/managed/CONNECT.md. The project is already connected to Wix — a wix.config.json (or .wix/) is already present — and the owner wants to add or change capabilities. Same flow as connect, but §1 skips init and reuses the existing wix.config.json; never re-init an already-connected project.

  • connect → references/managed/CONNECT.md. The user brings a design not yet connected to Wix and wants it wired: a frontend project on disk without a wix.config.json, or a brought-in/fetched design (a .zip/folder/file you unzip or read, a design-file URL, a Claude-Design/v0/Lovable export), or language like "connect this / implement this design (… connecting to Wix) / host this on Wix / deploy this to Wix / add Wix Headless to this project". A brought-in or fetched design is connect even when the current directory is empty — the design arrives from elsewhere (zip/fetch/URL), so emptiness at trigger time is not a create signal. (CONNECT.md step 1 places the brought design into CWD, then inits it.)

  • create → references/managed/CREATE.md. The user wants a new site built from a prompt with nothing brought in — "build me a site / store / blog…", no design file, no project on disk.

  • backend-only — the user only wants the backend configured (no frontend work). → the shared spine + emit the SDK handoff.

For self-managed and stripe, the operation is always backend-only (the host owns the frontend). Only when there is genuinely no brought-in design and no connect language does directory emptiness decide: empty → create; an existing frontend on disk → connect.

Preconditions (the host provides these — we read, never create)

  1. The project type — managed | self-managed | stripe — provided by the caller, else detected from project signals / user intent (see Project types § "Resolving the project type"), else asked. It selects <TYPE_DIR> (see Path resolution).

  2. A Wix metasite + a headless OAuth app exist, and credentials are available — obtained via the project type's AUTHENTICATION.md. The skill needs a bearer token authorized for the metasite and the metasite id.

  3. The user intent — free text describing what Wix should power ("add a store", "blog + contact form", "persist my app's data").

  4. (Optional) the project on disk — read-only, to sharpen brand/capability inference.

If the credentials are absent, the Wix backend isn't reachable — stop with a clear error.

What this skill does

Always open DISCOVERY.md first (it's agnostic — capability/brand/intent inference + the imagery gate, no auth). Then route by project type + operation:

Backend-only (self-managed, stripe, or managed backend-only) — the lean spine:

  1. Discovery (references/DISCOVERY.md) — infer capabilities + brand + intent + imagery.

  2. Setup (references/SETUP.md) — install the Wix apps those capabilities need.

  3. Seed (references/SEED.md) — create the backend content (+ entity images if imagery is on).

  4. Handoff (references/SDK_HANDOFF.md) — after Setup and Seed, emit the integration guide: SDK bootstrap, per-capability call shapes, the seeded IDs, and the @wix/* package list.

  5. Finalize deployment (<TYPE_DIR>/DEPLOYMENT.md) — run the project-type's finalize steps.

Throughout any run — if the user asks to send feedback to Wix, complains/gets frustrated, or the run hits any real friction (a confusing error, a doc gap, a tooling dead end, a workaround you had to invent — it doesn't need to repeat), offer to relay it to Wix per references/FEEDBACK.md. Default to offering rather than waiting to be asked. Every flow's finalize step (<TYPE_DIR>/DEPLOYMENT.md / managed/CREATE.md / managed/CONNECT.md) ends with the same checkpoint — treat it as a required self-check, not optional. Send only after an explicit yes — never automatically.

Managed create / connect / iterate — after Discovery, hand the whole run to the managed flow:

  • create → references/managed/CREATE.md (scaffold → Setup → Seed → build the frontend → release).

  • connect → references/managed/CONNECT.md (init → Setup → Seed → wire the existing UI → release).

  • iterate → references/managed/CONNECT.md — the project is already connected, so it reuses the existing wix.config.json (no init). Setup / Seed / wiring are incremental: it may already be set up and seeded from a prior run, so the agent checks current state first (installed apps, already-seeded content, existing wiring) and applies only the delta the new intent needs — never blindly re-installing or re-seeding. Re-release only if the frontend build output changed. These reuse the same SETUP.md/SEED.md/SDK_HANDOFF.md, but apply the SDK guide to build/wire the frontend themselves rather than emitting it, and release via managed/DEPLOYMENT.md.

Each Wix call uses the universal call shape (SETUP.md §1) with $TOKEN/$SITE_ID obtained per <TYPE_DIR>/AUTHENTICATION.md. The skill runs non-interactively except for the one imagery question (and asking the project type if it can't be resolved).

Don't smoke-test the frontend locally unless the user asks to verify. The deliverable is the built-and-released site (managed) or the SDK guide (backend-only) — not a local test report. By default do not start a dev server (wix dev / astro dev / npm run dev) to curl pages, drive the cart / booking / login flow, or launch a headless browser: correctness comes from following the recipes, real errors surface at wix build / wix release, and a headless run can't complete an interactive login or a real payment anyway — so these loops routinely burn minutes of wall for little signal (this is distinct from, and in addition to, the "release once at the very end" rule — that one only bans extra build+release cycles, not dev-server testing). Only spin up a dev server and smoke-test when the user's prompt explicitly asks to verify / test / confirm it works — and then keep it to a single lightweight pass (pages compile and render), not a full purchase/booking/login drive. The one post-release check in <TYPE_DIR>/DEPLOYMENT.md is the sanctioned verification.

Donations exception to the smoke-test policy above: for a build that accepts donations, follow the bounded anonymous API handoff check in references/inline-recipes/how-to-code-donations.md before claiming it works. It does not authorize a payment or campaign mutation, and does not require a dev-server testing loop. That recipe also defines the separate hosted-checkout and payment checks.

Path resolution

Compute <SKILL_ROOT> from this file (<SKILL_ROOT>/SKILL.md — strip /SKILL.md); hold the absolute path in scratch. Then resolve the project type to its folder and hold it too:

<TYPE_DIR> = <SKILL_ROOT>/references/<projectType>/ — one of managed/, self-managed/, stripe/.

WhatPath
Vertical index (intent matching + per-vertical site spec)<SKILL_ROOT>/references/CAPABILITIES.md
Discovery (infer capabilities + brand + intent; existing site → the Dynamic Context call in §1)<SKILL_ROOT>/references/DISCOVERY.md
Setup (install apps)<SKILL_ROOT>/references/SETUP.md
Seed (create backend content)<SKILL_ROOT>/references/SEED.md
SDK-integration handoff (emitted, or applied by create/connect)<SKILL_ROOT>/references/SDK_HANDOFF.md
Image generation (opt-in; agnostic)<SKILL_ROOT>/references/IMAGE_GENERATION.md
Design — fallback visual quality bar for the built frontend, when the user gave no design direction of their own (managed create only)<SKILL_ROOT>/references/DESIGN.md
Content — fallback copy quality bar for the built frontend, when the user gave no copy/voice direction of their own (managed create only)<SKILL_ROOT>/references/CONTENT.md
Experience overlays — a vertical's own design + copy bar on top of DESIGN/CONTENT (optional per vertical; read when that vertical is loaded)<SKILL_ROOT>/references/inline-recipes/experience-<vertical>.md (today: experience-store.md, experience-donations.md)
AI features — text/chat + embeddings (opt-in; agnostic)<SKILL_ROOT>/references/AI_FEATURES.md
Feedback — relay the user's headless-experience feedback to Wix (opt-in; user-approved)<SKILL_ROOT>/references/FEEDBACK.md
Authentication — obtain $TOKEN/$SITE_ID/clientId (project-type-specific)<TYPE_DIR>/AUTHENTICATION.md
Deployment — finalize the live site (project-type-specific)<TYPE_DIR>/DEPLOYMENT.md
Managed create flow (scaffold a new project)<SKILL_ROOT>/references/managed/CREATE.md
Managed connect flow (wire an existing project)<SKILL_ROOT>/references/managed/CONNECT.md
Frontend-axis references (how a frontend wires to Wix)<SKILL_ROOT>/references/astro.md, non-astro.md

Start a run by opening DISCOVERY.md. The flow files (CAPABILITIES, DISCOVERY, SETUP, SEED, SDK_HANDOFF, IMAGE_GENERATION, AI_FEATURES) are project-type-agnostic; the per-type specifics live under <TYPE_DIR>/ (AUTHENTICATION.md, DEPLOYMENT.md, and — managed only — CREATE.md/CONNECT.md).

Where the how comes from

This skill has no skill upstream — the how is read from the live Wix docs at dev.wix.com/docs. Read-priority: a page this skill links is read by curl-ing its .md twin directly (first priority — don't re-discover a curated link with search); the Wix MCP doc/search tools are second priority, for finding pages the skill doesn't link or as a fallback if a fetch fails. (Append .md to any docs URL for raw markdown; menu pages list child links, content pages carry the schema.)

Doc discovery is the shared fallback for both tracks — never the first move. Each track's primary source is its pinned material (below); when that doesn't cover what you need, fall back to references/DOC_DISCOVERY.md — a semantic doc-search + schema lookup that works with or without the Wix MCP.

  • Seed reads each capability's create flow from its inline recipe — a self-contained local inline-recipes/setup-*.md (mapped per capability in SEED.md § "What to seed per capability") that inlines the calls and supersedes the REST doc pages, so read it and seed from it alone. Only a capability with no inline recipe (e.g. coupons) falls back to doc discovery (DOC_DISCOVERY.md).

  • Handoff links the SDK docs for each capability's API shape, and supplies the runtime package set from the inlined map in SDK_HANDOFF.md (the SDK .md pages don't expose @wix/* import strings to navigation, so packages are mapped, not navigated).

Setup carries its app-install call (and the appDefId constants) inline in SETUP.md; CAPABILITIES.md is the vertical index that lets Discovery match intent and declares, per built vertical, the Required site features + Implementation checklist that Seed enables (backend-backed features) and the Handoff carries into the guide (so the host builds a complete site, not a bare data dump). This skill carries the what (which capabilities, how much content, what a finished site includes) and reads the how off the docs.

Files

references/inline-recipes/how-to-code-a-blog.md


name: "How to Code a Blog" description: The frontend read contract for a Blog V3 site — which @wix/blog modules to import, how to list/get posts with the mandatory RICH_CONTENT fieldset, how to resolve categories/tags/cover media, how to render Ricos rich content, and the read-public/write-authenticated comments flow. Specifies the how (modules + exact calls + the failure modes the docs omit); which posts to render come from the blog the site reads.

RECIPE: How to Code a Wix Blog Frontend (Blog V3 + Ricos rich content)

A concise contract for writing the frontend code of a blog against a Blog V3 site: listing posts, opening a post by slug, rendering its rich content, resolving categories/tags/cover images, and (optionally) reading and submitting comments. This recipe is the how (which modules, which calls, which fields), not the what — which posts to show, how the page looks, and the framework are decided by the request you're fulfilling.

This recipe is for CODING the blog, not for seeding it. It assumes a Blog V3 site already exists (published posts, optional categories/tags). It says nothing about creating posts — only how to read and render them from frontend code.

⚠️ Reading rule — always append .md?apiView=SDK to every doc link below. The Wix docs render two views of the same page. The bare / REST view shows id; the ?apiView=SDK view shows _id — and the SDK is what your frontend calls. Reading the REST view by mistake is the most common source of undefined-id bugs (links to /blog/undefined). Fetch the .md?apiView=SDK form directly; if a field name surprises you, you're probably reading the REST view.


The modules and the client (read this first)

Wix Blog app id (a constant Astro needs for blog-post page routing, and comments need as appId): 14bcded7-0066-7c35-14d7-466cb3f09103

⚠️ CRITICAL: blog posts are NOT CMS collections — use @wix/blog, never @wix/data. Querying blog content through @wix/data reads the wrong store and returns nothing. Import only:

NeedPackageModule
Posts (list, get, query by slug)@wix/blogposts
Categories (resolve categoryIds)@wix/blogcategories
Tags (resolve tagIds)@wix/blogtags
Render rich content@wix/ricosRicosViewer + quickStartViewerPlugins
Resolve wix:image:// cover URIs@wix/sdkmedia
Likes — like/unlike a post (only if the site has members)@wix/bloglikes
Comments — read/submit (only if the blog has comments)@wix/commentscomments
Comment/like author name/photo (only with members)@wix/membersmembers

Discover the exact current call shapes with SearchWixSDKDocumentation (e.g. "blog query posts", "comments queryComments createComment") rather than walking a module menu — the menu pages often surface only dashboard/extension pages, not the runtime query functions. The @wix/ricos viewer API moves between versions — follow the blog doc to the current viewer API; don't pin a version blind.

Auth / client — framework split:

  • Astro (Wix-managed): authentication is ambient. Call posts / categories / tags directly from server components and backend routes (src/pages/api/*.ts) — no createClient, no OAuthStrategy, no clientId.

  • Non-Astro (Vite/React/Vue/static): build one manual visitor client and reuse it:

    import { createClient, OAuthStrategy } from '@wix/sdk';
    import { posts, categories, tags } from '@wix/blog';
    
    const client = createClient({
      modules: { posts, categories, tags },
      auth: OAuthStrategy({ clientId: /* the project's PUBLIC OAuth client id */ }),
    });

    The clientId is public, not a secret.


The blog features (build the ones the site needs)

Each section below is a self-contained blog feature — implement only the ones the site uses; they don't have to be built in order. The only ordering is within a feature (e.g. resolve categoryIds after you have the post).

Listing posts (and the RICH_CONTENT + _id rules)

Query posts with posts.queryPosts(...), newest first:

const { items } = await posts
  .queryPosts({ fieldsets: ["RICH_CONTENT", "URL"] })
  .descending("firstPublishedDate")
  .limit(20)
  .find();

Doc: https://dev.wix.com/docs/api-reference/business-solutions/blog/posts-stats/query-posts.md?apiView=SDK

⚠️ CRITICAL: request the RICH_CONTENT fieldset, or post.richContent is undefined. queryPosts omits the body by default; without fieldsets: ["RICH_CONTENT"] the post comes back with no richContent, and the detail page renders blank. (Add "URL" to get post.url/slug for links.)

⚠️ CRITICAL: the entity id is _id, NOT id. The SDK normalizes every entity's id to _id; post.id is undefined in SDK code. Use post._id for keys and lookups, and post.slug for links (/blog/${post.slug}). (A surprising field name means you're reading the REST doc view — re-open it with ?apiView=SDK.)

Visibility: only published posts are returned to a visitor token, so a missing post usually means it wasn't seeded publish: true — not a query bug (ties back to the seed recipe).

Opening a post by slug

Filter by slug and take the first item:

const { items } = await posts
  .queryPosts({ fieldsets: ["RICH_CONTENT", "URL"] })
  .eq("slug", slug)
  .find();
const post = items[0];
if (!post) { /* 404 → redirect to /blog */ }

Astro page routing + SEO (Wix-managed) — wixMetadata is required. A blog-post detail page (src/pages/blog/[...slug].astro) is a Wix item page: its <title>/description/OG/canonical come from what the owner sets in the dashboard. Wire it per the canonical guide — Add SEO Support to Item Pages — which covers all three steps: export wixMetadata (registers the route → sitemap + dashboard SEO editor), call loadSEOTagsServiceConfig(...), and render <SEO.Tags> (from @wix/seo; deps + @wix/essentials ≥ 1.0.10 are in the guide's "Before you begin"). Source wixMetadata from WIX_APPS, referenced directly inside the export (it's evaluated in module scope):

import { WIX_APPS } from "@wix/essentials";
import { seoTags } from "@wix/seo";           // → itemType: seoTags.ItemType.BLOG_POST

export const wixMetadata = {
  appDefId: WIX_APPS.blogs.id,
  pageIdentifier: WIX_APPS.blogs.postPageMetadata.pageIdentifier,
  identifiers: { slug: WIX_APPS.blogs.postPageMetadata.identifiers.slug },
};

Use the [...slug] rest param (not [slug]), and Astro.params directly — Wix headless projects run output: "server" (SSR), so there's no getStaticPaths(). If you add a blog category route (e.g. /category/[slug]), wire it the same way with WIX_APPS.blogs.categoryPageMetadata + seoTags.ItemType.BLOG_CATEGORY. ⚠️ Dashboard SEO overrides for blog categories may not be honored by the resolver (it can return label-derived defaults) — the route still registers and gets valid default tags, so this is a Wix-side gap, not a wiring bug.

Rendering the post body (Ricos rich content)

The body is Ricos (post.richContent), not HTML — never set:html={post.content} (there is no .content), and never String(node). Render it with @wix/ricos:

// src/components/RicosViewer.tsx
import { quickStartViewerPlugins, RicosViewer } from '@wix/ricos';
import '@wix/ricos/css/all-plugins-viewer.css';

const plugins = quickStartViewerPlugins();   // module-level, once — not per render

export default function RicosContentViewer({ content }) {
  if (!content) return null;
  return <div className="ricos-content"><RicosViewer content={content} plugins={plugins} /></div>;
}

Doc: https://dev.wix.com/docs/api-reference/business-solutions/blog/introduction.md?apiView=SDK (follow it to the current Ricos viewer API; verify with SearchWixSDKDocumentation "ricos viewer").

⚠️ CRITICAL (Astro): render the viewer with client:only="react". @wix/ricos is a React component that breaks under SSR. <RicosViewer client:only="react" content={post.richContent} /> makes it render client-side only. @wix/ricos accepts the camelCase richContent from the @wix/blog SDK directly — no key renaming.

⚠️ Ricos text invisible on dark themes. The Ricos library CSS hardcodes near-black text color on paragraphs/lists. If the site theme is dark, scope an override on the .ricos-content wrapper forcing var(--color-text) — and in Astro use <style is:global>, because React islands don't inherit scoped Astro styles.

For a short excerpt/card summary use post.excerpt (a plain string) — not the raw richContent nodes.

Resolving categories and tags

post.categoryIds / post.tagIds are id arrays — resolve each to a label:

const { category } = await categories.getCategory(id);   // ENVELOPE — destructure { category }
const tag = await tags.getTag(id);                        // returns the BlogTag DIRECTLY — do NOT destructure

Docs: https://dev.wix.com/docs/api-reference/business-solutions/blog/category/get-category.md?apiView=SDK · https://dev.wix.com/docs/api-reference/business-solutions/blog/tags/get-tag.md?apiView=SDK

⚠️ CRITICAL: the two return shapes differ. categories.getCategory(id) returns an envelope { category } — destructure it. tags.getTag(id) returns the tag object directly — destructuring it as { tag } yields undefined. Getting this backwards is a silent undefined.label.

Rendering the cover image

A post's cover lives at post.media?.wixMedia?.image and may be a wix:image:// identifier, not a ready URL. Resolve it with the SDK media module:

import { media } from '@wix/sdk';
const coverUrl = post.media?.wixMedia?.image
  ? media.getImageUrl(post.media.wixMedia.image).url   // or media.getScaledToFillImageUrl(ref, w, h)
  : undefined;

Never hand-build a static.wixstatic.com/.../v1/fit/... URL — the format is easy to get wrong and the image then 403s. Only wix:image:// values need resolving; an already-absolute https:// URL (e.g. an Unsplash placeholder seeded when imagery is off) goes straight into <img src>. Constrain Wix image URLs with aspect-ratio + object-fit: cover so they don't overflow at intrinsic size. Doc: https://dev.wix.com/docs/sdk/core-modules/sdk/media

Member features (only if the site has the members capability)

When the site has members (login — see how-to-code-members-astro.md / -non-astro.md), two blog features become member-native. Both follow the same read-public / write-as-the-logged-in-member shape as everywhere else — resolve identity at the action, never gate the whole page, and never auth.elevate() for a member acting on their own behalf.

⚠️ Members-only (gated) content — gate on a LIVE, queryable signal, never a hardcoded id/slug list. If the brief gates full articles to paying members, decide "is this post gated?" from a signal carried on the post itself and read at request time — a members-only blog category or tag, or a boolean field on a companion CMS record — so a gated post the owner publishes later self-classifies with no code change. Do NOT gate by a hardcoded list of "premium" post slugs/ids frozen at build time: a members-only post added afterward would read as public (an owner edit silently lost). Combine the gate with the member check — resolve the visitor's plan/login at the action, and reveal the full body only when both the post is flagged gated and the member is eligible (plan eligibility is itself a live read — see how-to-code-pricing-plans.md).

⚠️ Members can LIKE and COMMENT — they CANNOT author or manage posts. Every draft-post write/query method (createDraftPost, updateDraftPost, publishDraftPost, deleteDraftPost, queryDraftPosts) is admin-only (applicableIdentities: [APP], Manage-Blog scope) — a member token is rejected. Blog authoring is a back-office capability; the seed recipe's memberId only attributes a post to a member, it doesn't grant members authoring rights (setup-blog.md STEP 1). Do not build a "write a post" / "my drafts" member surface expecting the member's own session to work. (It's only achievable by an app-mediated backend that auth.elevate()s to APP, creates on the member's behalf, and enforces per-member ownership itself — an authoring workflow with moderation implications, not a drop-in feature. Don't build it unless the brief explicitly asks.)

Likes (member-native)

Liking is a first-class member action — likes.createLike / deleteLike / queryLikes accept a MEMBER identity (not admin), so a logged-in member likes/unlikes a post directly.

  • Show the count + "liked by me": likes.queryLikes (public read) for the per-post total; the current member's like state comes from their own likes. Post-level engagement counts are also on the post via the metrics fieldset.

  • Toggle: on click, POST to a backend endpoint (src/pages/api/*.ts) that calls likes.createLike / deleteLike with the request session; if the caller isn't a member, redirect to /api/auth/login?returnUrl=… (same gate-on-action shape as comments). Keys off the post id (post._id).

  • Discover shapes: SearchWixSDKDocumentation "blog likes createLike queryLikes".

Comments — read public, write authenticated

⚠️ Intent-gate this feature. Comments hard-depend on members/login, so build them only when the brief explicitly asks for reader comments or discussion. An unrequested comments feature drags in an unrequested login gate — consistent with the CAPABILITIES.md blog entry (comments are optional / intent-gated, not part of the baseline blog surface). Reading comments is public; submitting / editing / deleting needs a logged-in member — render the thread always, and resolve identity at the action (show a "log in to comment" prompt to anonymous visitors, not a form that bounces).

Package: @wix/comments (comments). The API keys off the post's referenceId — request the REFERENCE_ID fieldset when fetching the post, then contextId = resourceId = post.referenceId, and appId = "14bcded7-0066-7c35-14d7-466cb3f09103" (the Blog app id).

  • List (public, SSR) — use listCommentsByResource, NOT queryComments. comments.listCommentsByResource(APP_ID, { contextId, resourceId, commentSort: { order: "OLDEST_FIRST" }, cursorPaging: { limit } }) → returns { comments }. ⚠️ The docs' queryComments example ships wrapped in auth.elevate(comments.queryComments) — an admin path that must NOT be used for the public/anonymous SSR read. Reaching for queryComments steers you straight into that elevated example; use listCommentsByResource for the visitor read.

  • Comment body is Ricos, not a string. createComment / updateComment take content: { richContent: <ricos-doc> } — the same { nodes: [{ type:"PARAGRAPH", nodes:[{ type:"TEXT", textData:{ text, decorations:[] }}]}]} shape as post bodies. Convert the textarea string ↔ Ricos yourself (a small plainTextToRicos / ricosToPlainText helper).

  • Submit (member-gated): POST to a backend endpoint (src/pages/api/*.ts) that resolves the session and calls comments.createComment(...); if the caller isn't a member, redirect to /api/auth/login?returnUrl=… (framework-provided on managed Astro — no src/pages/api/auth file needed, @wix/astro emits it at build). Not a client island.

  • Edit / delete own comment — ownership is app-enforced. The SDK does not enforce ownership server-side, so you must: fetch first (comments.getComment(id)), check existing.author?.memberId === member._id, then comments.updateComment(id, { revision: existing.revision, content }) (⚠️ update requires the fetched revision) or comments.deleteComment(id).

  • Comment count: request the METRICS fieldset on the post fetch and read post.metrics.comments. Do not call comments.countComments — it needs elevation.

  • Author name/photo: resolve comment.author?.memberId (and post.memberId) via @wix/members. Comment fields normalize to _id / _createdDate (same _id rule as posts).

  • Pagination / "load more": listCommentsByResource is cursor-paged — pass cursorPaging: { limit } and follow the returned paging cursor for the next page; don't offset-page.

  • "Edited" indicator: after an update, comment.contentEdited === true — render an "(edited)" marker.

  • Threaded replies (optional, only if the brief wants nested discussion): a reply carries comment.parentComment (present only on replies); comment.replyCount is the number of replies; fetch one comment's thread with comments.getCommentThread(commentId, …). For a flat thread (the common case), ignore parentComment and just render the listCommentsByResource results in OLDEST_FIRST order.

  • Optional extras (wire only if asked): comment votes — comment.voteSummary.upvoteCount / downvoteCount; and marking/pinning — comment.marked.

⚠️ REST-vs-SDK permission trap. The raw REST comments methods all report applicableIdentities: [APP] (admin) — but the @wix/comments SDK path resolves the read as public and the write as the logged-in member. Don't let the REST spec push you into auth.elevate()-ing the read or the member write — that's wrong for the visitor thread. Only the genuine moderation calls (hideComment, moderateDraftContent, countComments, markComment, publish/bulk-*) need elevation, and those are back-office, not part of the visitor-facing feature.


Conclusion

A correct Blog V3 frontend:

  • imports posts / categories / tags from @wix/blog (+ @wix/ricos, media) — never @wix/data for blog content;

  • queries with the RICH_CONTENT fieldset (else richContent is undefined) and uses post._id (never post.id) and post.slug for links;

  • renders the body with @wix/ricos RicosViewer (client:only="react" in Astro, .ricos-content color override for dark themes) — never set:html, never raw nodes;

  • destructures categories.getCategory as { category } but takes tags.getTag directly (not { tag });

  • resolves wix:image:// covers via the SDK media module — never a hand-built CDN URL;

  • exports wixMetadata on the Astro [...slug] detail page;

  • if comments exist, reads them public/SSR and submits via an authenticated API endpoint keyed on post.referenceId + the Blog appId;

  • if the site has members, wires likes (@wix/blog likes, MEMBER-scoped) and comments as member-native, gate-on-action features — but never a member post-authoring surface (all draft-post methods are APP-only; a member token is rejected).

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Node.js

Security

What our scanner noticed· Low risk

  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
Wix
Publisher
Wix (Official)
Source
wix/skills · skills/wix-headless · commit d168bc2
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Wix or Wix.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download wix-headless.zip