Appearance
Preview and publish
From an edit to a live page
Preview is a rehearsal. Publishing selects which reviewed pages become live; other edits stay out of the live release. The diagram shows a valid review path, not automatic approval merely because someone opened a URL.
Content publication keeps the current live code selection. If that code no longer matches the reviewed pair, publication must pass its version checks rather than silently substituting code. Releasing new frontend code is a separate operation; see roll out frontend code.
Commands
With FOLIWAKE_CONFIG set as in the quickstart, these commands run from the Foliwake checkout:
bash
pnpm foliwake page changes --changed
pnpm foliwake preview
pnpm foliwake publish home --expect <sr_id-from-preview> --wait
pnpm foliwake site status
pnpm foliwake serve allpreview saves valid drafts to the preview channel. publish home selects only the page with id: home; other edited pages remain drafts. --expect binds publication to the preview release you reviewed and the code you saw it with; copy the release ID printed by preview, which means the page as the plain preview host shows it. A branch host shows other code, so its pages answer X-Publish-Expect: sr_…@cd_… instead: pass that value, and publication is refused unless that code is the code going live. A preview made with preview --code is refused too, until that code is live and the preview is prepared again. Snapshot-based sources require this check. --wait waits for cache invalidation within a bounded timeout. A confirmed publication can succeed while cache refresh remains pending; visitors may still see the earlier version. The live and preview listeners use the hosts configured for the site. Preview is protected when exposed beyond loopback; use HTTPS and a configured preview token. Keep dev local as well.
To remove a live page or restore an earlier full release:
bash
pnpm foliwake page unpublish home --expect <live sr_id>
pnpm foliwake site status --json
pnpm foliwake release rollback <sr_id> --expect <live sr_id>The earlier site release ID comes from site status --json (codeRollout.rollbackTo is one step back); --expect is the live release you saw, so a rollback never drops a release nobody looked at. A full rollback restores that release's content and code; it does not edit working source files.
Remove a page from the preview
page unpreview takes one page out of the preview by its path; live is never touched:
bash
pnpm foliwake page unpreview --path /old-draft --expect <preview sr_id> # or --latest-previewA page that is not live leaves the preview. A live page with an unpublished edit shows its live version in the preview again (the preview follows live wherever it has no edit of its own). A page the preview already shows as it is live is refused: page unpublish takes it off both. When a content source still has a file for the page, the result warns that the next full preview brings it back: delete the file in the source, or exclude it with an ignore mapping rule. Refused while new code waits in the preview, and when the preview is not the one you expected — also when another preview is saved before this one commits (it is never applied to the newer preview: look again and run it again).
It is a separate command rather than page unpublish --preview: unpublish names pages by ID and expects the live release, unpreview names a path and expects the preview release.
A source file deleted and uploaded again
With file-ID identity (Google Drive), a file deleted and uploaded again is a new file. When it lands at the same place and the old file is gone, the sync keeps the page: the new file feeds the same page ID, address and live version (warning SOURCE_PAGE_REPLACED), and you preview and publish it as an ordinary change. When the sync cannot tell (the file went into another folder, or the old one is still there), let the new file feed the published page yourself:
bash
pnpm foliwake page replace --path /lessons/signs/ru --with <Drive file id>It shows the plan (the page, the file that feeds it now, the new file and the path it reads as) and asks before it changes anything (--yes in scripts). Then sync the source; live changes only when you publish. Every replacement, automatic or by the command, is recorded in the state database (page_replacements).
Blocks the code does not know yet
A page that uses a site block the code does not define (or content its definition does not accept) does not stop a sync or a preview of the other pages. In the preview the page shows a box "Block :::name cannot be shown with this code" with the reason, and the sync and preview report it as a warning on that page. Publishing that page is refused with the error, and a release of new code (migration commit, the dashboard's Release) refuses a preview that still shows such a box. Markdown mistakes (an unclosed :::, a nested block) are errors as before.
See a document as a page (author view)
An author who edits a Google Docs document can see it as a page now, before any sync or preview:
text
https://<site>.<preview domain>/_foliwake/view/<document id><document id> is the ID in the document's address (docs.google.com/document/d/<document id>/edit). The browser extension opens this address with its View button; it can also be opened by hand. The page is compiled with the site's live code and shown in its page shell, with a banner of the page's problems (each with the line of the generated Markdown and the element of the document where it is). Images load from the document as the browser asks for them. Add ?fresh to read the document again even when it has not changed; ?tab=<tab id> picks a tab of a document with several tabs.
Nothing is saved: no sync, no snapshot, no preview release. A view cannot be published; Preview and Publish work as before. A view checks the page alone: links to other pages, page paths taken by other pages and image files are checked by preview.
Who may open a view: an account with access to the site (any role), signed in through the preview hand-over (the browser is sent to the dashboard's sign-in once and comes back) or with a sign-in key (Authorization: Bearer fwk_…, as the browser extension and the CLI have). The site's shared preview password does not open a view, since it does not say who looks. Over core the same view is authors.view (and its images authors.viewMedia).
The document must be in the folder of one of the site's sources (a google-drive-markdown source with "docs": "read"); any other document is "not found". The first view of a document takes about half a second to a second and a half (Google's answers), a second view of an unchanged document a few tenths of a second.
Use the dashboard
Run pnpm foliwake admin --port 0 and sign in with an e-mail link (see accounts, roles and sign-in). On Preview & publish, update the preview, open the page previews, select the pages to release and confirm publication. A newer preview clears your selection; a stale confirmation is rejected rather than publishing an unseen version. Unpublish remains a CLI operation. The Frontend screen shows new code waiting in preview, with Release and Roll back one step.
Publish from Drupal
The Drupal editor integration adds Save and update preview, a version-specific review page and a confirmation form in Drupal. The preview toolbar's Publish to live link opens that form; it does not publish on click. Related article lists are selected explicitly.
See the author walkthrough and developer setup. The existing dashboard workflow above remains available without the Drupal module.
Release frontend code
Code comes from a clean commit of the configured frontend Git repository. It goes live through the preview, together with every page rebuilt against it:
bash
pnpm foliwake code prepare # prints cd_…; nothing changes
pnpm foliwake migration prepare cd_… --rev <sha> # every live page rebuilt in preview; live unchanged
pnpm foliwake migration commit --expect sr_…@cd_… # code and pages live as one releaseSee roll out frontend code for the whole flow and branch previews for branches. Review the preview between the last two steps; the dashboard's Frontend screen shows the waiting code, its commit, the pages whose text changed since live (they go live with the release) and a Release button. The hosted workflow of a frontend repository runs the first two steps on every push to main; nothing goes live without a release. code release <cd_id> --latest-live still switches code alone while keeping live content, for emergencies. pnpm foliwake code rollback <previous_cd_id> --latest-live restores earlier code without changing content. pnpm foliwake branch bootstrap and pnpm foliwake branch update <branch> --rev <branch> --latest-selection create code-specific branch previews; the branch's preview still uses the current saved draft content.
operation recover --wait has a bounded wait too; exit code 3 means cache work remains pending for a later attempt. You can set --wait-timeout <seconds>.
If an operation is interrupted, run pnpm foliwake operation recover --wait with the same configuration. See troubleshooting for state and storage failures.
Move the whole site to new code or a new default dialect
Most changes are page by page, but changing authoring in site.yaml on a site with live pages is not: promoting such code is refused (AUTHORING_DEFAULT_CHANGED) and names this procedure. The same procedure rebuilds every page against any new code before it goes live.
Update the site code first. Then:
bash
pnpm foliwake code prepare # prints cd_…
pnpm foliwake migration prepare cd_… # prints sr_…; live does not change
pnpm foliwake serve preview # review the whole site with the new code
pnpm foliwake migration commit --expect sr_…@cd_… # prints the release to roll back toOn a site with connected sources, if a sync rejects content that is valid only under the new code, run pnpm foliwake source sync --code cd_… between the first two steps. It checks that sync against that code. Until the commit, a plain source sync and preview still use live code and can refuse the same content.
migration prepare rebuilds every live page. A missing or invalid source stops it, so fix the page or name it with --remove page-a,page-b. Pages that are not live stay out unless named with --add page-c. If live or the preview changes before the commit, the commit is refused: prepare and review again.
To go back, run pnpm foliwake release rollback <sr_id> --expect <live sr_id> with the release the commit printed. It restores the old content and code together. code rollback across a default change is refused.
When does a visitor see the new version?
The storage commit and cache refresh are separate events. A failed purge leaves publication committed and retry work pending; it does not restore the old release. The normal selected-page flow targets affected URLs. Code changes and other pending operations may require broader invalidation.
Refresh has immediate and delayed final phases. The diagram simplifies those phases into one refresh step. It does not imply every browser or CDN location changes at the same instant.
When the cache configuration changes
Publication and cache refresh are separate responsibilities. Foliwake remembers whether a publication needed a cache refresh before changing the live pointer. Restarting with different settings does not rewrite that decision.
| Situation | What happens |
|---|---|
| No cache is configured when publishing | The publication completes without queuing a refresh. Adding a cache later does not create work for that publication, including after crash recovery. |
| A cache is configured, but purge fails | The release is live at the delivery service. Refresh work stays pending; cached visitors may still see the earlier response. |
| The cache configuration is removed while refresh work remains | The work stays pending. It is neither discarded nor reported as successfully purged. |
| A cache is configured again | Run operation recover --wait to retry the retained work against the site's currently configured cache, even if its endpoint changed. |
| Old records do not say whether a cache existed | Keep them pending without a cache; with a cache, process their recorded invalidations. Foliwake does not guess from timestamps. |
A configured cache with a missing purge credential is a failure to refresh, not evidence that no cache exists. Restore its credential and retry.
While no cache is configured, operation recover --wait reports retained work promptly and exits with code 3. The jobs can remain stored indefinitely, but the command does not wait indefinitely for an operator to configure a cache. There is currently no command to explicitly retire these jobs. Do not delete the state database to clear the warning.
Recovery after losing or restoring state
The published releases live in object storage, but pending refresh jobs live in the local state database. A new database or an older backup may not know about releases already committed to storage.
Recovery creates one all-HTML refresh operation for the unexplained history. It cannot infer whether those releases needed a cache refresh from today's configuration. Both refresh phases remain pending if no cache is configured.
Repeating recovery against the same history does not create duplicate jobs. Once a cache is configured, recovery performs the immediate and delayed final phases. After successful completion, another recovery sends nothing for that operation. New publications or additional unexplained history can require new work.
An ordinary publication whose intact state explicitly records “no cache” does not need this conservative refresh. Losing that state loses the evidence, so an extra purge may be necessary. For backup and upgrade steps, see troubleshooting.
