Skip to content

Publish Citecue pages under the site folder (page_folders) - #27

Draft
henry-mosh wants to merge 2 commits into
mainfrom
feat/page-folders
Draft

henry-mosh wants to merge 2 commits into
mainfrom
feat/page-folders

Conversation

@henry-mosh

Copy link
Copy Markdown
Collaborator

Lets Citecue publish answer pages under the site's folder (for example /resources/faq/) as real WordPress pages, instead of top-level pages served at /ai-answers/. App side: henry-mosh/citecue_app#1238.

What changes

  • page_folders capability, declared on connect. Not added to the Reconnect notice: after an update the plugin self-refreshes it by scheduling one wp-cron event (citecue_refresh_capabilities) that POSTs its capabilities to /api/delivery/v2/connect/capabilities (backoff 1 h → 6 h → 24 h; never inline on a front-end request).
  • POST {restUrl}slug-check ({ parent_path, slug }), signed like /content, writes nothing. Replies with the slug a new page would get under that parent, counting draft, private and trashed pages as taken, or folder_conflict when the folder path is other content. That includes the post permalink prefix (e.g. /blog/ on a /blog/%postname%/ site), the category/tag base, and public post type or taxonomy rewrite slugs. A non-page post already at /<folder>/<slug>/ counts as taken.
  • parent_path on /content page inserts (and Autopilot operations): each missing folder level is created as a draft page (title from the segment); an existing page at the path is reused untouched. Exact slug or 409 citecue_slug_taken; 409 citecue_folder_conflict; both create nothing. Updates never re-parent. First pushes into a new folder take a short per-folder lock (503 citecue_busy if held). A failed child insert removes the folder pages it just created.
  • Draft permalinks: a draft page under a folder reports its pretty permalink (via get_sample_permalink) in the push reply, the Autopilot observation and status reports, so Citecue can confirm the address before the page goes live.
  • New class: includes/class-citecue-page-folders.php.

Verification

  • PHPUnit: 608 tests, 0 failures (20 pre-existing skips), with new test-page-folders.php (24 tests), test-page-folders-serving.php and test-capability-refresh.php.
  • test-page-folders-serving.php proves WordPress serves a published child of a draft parent publicly at /<parent>/<child>/ (no canonical redirect) and returns 404 for the draft parent itself.
  • Not run: the Docker seam check (Docker unavailable locally).

🤖 Generated with Claude Code

henry-idingo and others added 2 commits December 5, 2026 15:56
…age_folders capability with self-refresh

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t the child URL; lock first pushes into a new folder

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant