@fluid-app/fluid-cli-pages
v0.1.51
Published
Fluid CLI plugin for storefront Pages — create a Page with its own theme template, then list, update, publish, and delete Pages
Readme
@fluid-app/fluid-cli-pages
Fluid CLI plugin for storefront Pages. fluid pages create creates a Page
together with its own page template in a theme and links the two, the same
operation as Mist's create-page tool.
npm install -g @fluid-app/fluid-cli @fluid-app/fluid-cli-pages
fluid login
fluid pages walk # answer questions in the terminal instead
fluid pages create --title "Spring Wellness Guide" --yes # Page + template, linked, as a draft
fluid pages create --title "Spring Wellness Guide" --theme "Maple" \
--template-from landing --publish --yes # copy another page template's Liquid, then publish
fluid pages list --status draft # --cursor pages through
fluid pages show spring-wellness-guide # id or slug
fluid pages template spring-wellness-guide # the template and its Liquid
fluid pages template spring-wellness-guide --content-file page.liquid --publish --yes
fluid pages update spring-wellness-guide --title "Spring Guide" --yes
fluid pages publish spring-wellness-guide --yes
fluid pages unpublish spring-wellness-guide --yes
fluid pages delete spring-wellness-guide --yes # keeps the template; prints its idHow create works
A Page holds the metadata (title, slug, description, status). What it looks
like comes from a page template, a Liquid file in a theme. create makes both
and links them:
- creates a page template in the theme (
--theme, or the active theme), named after the title unless you pass--template-name. It starts from--content-file,--template-from, or a minimal title-and-description layout. Unless you pass--blank, the Page also loads the theme's stylesheets (its brand style); - creates the Page as a draft, with the slug pinned;
- assigns the template to the Page;
- reads both back to confirm the link;
- publishes the Page when you pass
--publish.
If a step after the template fails, the draft Page and the template are removed and the error says so. They are kept, with their ids in the error, when your session expired mid-way or when the link couldn't be read back.
assignment in the result is direct-page when the template is in the active
theme. A template in another theme is theme-scoped: the Page uses it once
that theme is active, and previewPath carries ?theme_template_id= so you
can preview it now.
Walk through it
fluid pages walk asks for the same things as create, one question at a
time: the title, the slug (suggested from the title), the template (new with
the theme's brand style, new and blank, or a copy of an existing page
template, picked from a searchable list), and the theme (the active one, or
pick another). Type < to go back, > to skip and take the default, or ?
for a menu that jumps to any question; Ctrl-C stops. Nothing changes until
you confirm the summary. Then it creates the page as a draft through the same
steps as create, offers to publish it, prints its URL, and offers to
replace the template's Liquid from a file. It needs a terminal; in a script,
use create.
Editing the template
fluid pages template <page> --content-file <file> replaces the Liquid as a
new draft version; add --publish to make it live. For sections, settings,
and the rest of the theme, use fluid themes and the theme development docs
at https://docs.fluid.app/themes/overview.
Every command prints JSON; failures print a JSON error on stderr and exit
non-zero. Commands that change the live storefront ask for confirmation
unless you pass --yes.
