Getting StartedStatic Site GenerationVisual EditorEdit via CLIComponentsFontsWebhooks

Visual Editor

This chapter demonstrates using afia website edit to start a visual editor for your site.

Begin by creating a new Afia workspace:

mkdir my-workspace
cd my-workspace
afia init

Next, start an editing server for the website that was just created:

afia website edit --website basic

The afia website edit prints a link to the website editor. Click the link to begin editing your site.

Programmatic Editing Sessions

Humans and computer programs can edit the same site together, in real-time.

First, start the editing server:

afia website edit -w basic --ses-port 9500

The afia website edit command prints an address, identifier and API key for connecting to the session.

To send a single programmatic edit, point one of the Afia CLI's editing commands to the editing session. Here is an example using afia page create:

afia page create --slug=about --route=/about --ses-addr=localhost:9500 --session=ses_session_id_here --api-key=dev-key

To send and receive many edits over time, begin by joining the editing session:

afia join --ses-addr=localhost:9500 --session=ses_session_id_here --api-key=dev-key

afia join starts a REPL where you can edit a site via stdin. Your edits will appear in the visual editor in real time.

Afia 0.0.8
Type "help" for more information.
> ...

To create a new page section, enter the following into the REPL.

> afia pagesec create --page=home

To undo your most recent edit:

> undo

To reverse the previous undo:

> redo