I find it easier to make page json if I add the Item ids and Journal Actions once I have the Title and Story done. This example makes a bunch of map pages using this technique with no external dependents. github
We will use data from this page as locations for our new maps.
An export file contains keys-value pairs where the keys are page slugs and the values are page json. We'll look at one by exporting about.fed.wiki, a small site. export
We use this site as something small to be exported, examined and then emulated.
We will code our example in Deno as a script we will run at the command line. We will post the script and the export file it produces as assets on this page. Click to download either. Install Deno to run the script yourself. deno
pages/script-to-make-pages
It is unusual to fork the ghost page that offers to import exported pages. I have done so here so that you can more easily view the script results.
Import of 30 pages (16,053 bytes) from an export file dated Fri Mar 18 2022 17:05:32 GMT-0700 (Pacific Daylight Time).
.
Since ES6 variables are preferably declared with let or const rather than the traditional var. Const means only that a variable won't be reassigned in the current scope, not that the objects it holds won't vary. Deno's lint prefers const over let so we will go along.
deno lint script.js