Skip to content

Commit c9c97ae

Browse files
committed
docs: add pages-as-files feature documentation
1 parent 9f461f1 commit c9c97ae

2 files changed

Lines changed: 38 additions & 1 deletion

File tree

versioned_docs/version-26.1.2/basics/page-types/page-types.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ The following attributes are available for all page types
1111
### **type** (String, _mandatory_)
1212

1313
The type of page, it determines which loader is used to load the json data and how the page will be displayed.
14-
Needs to be fully qualified `domain:name`, e.g. `modonomicon:text`.
14+
Needs to be fully qualified `domain:name`, e.g. `modonomicon:text`.
15+
16+
### **id** (String, _optional_)
17+
18+
A string to uniquely identify the page within the entry it belongs to. Used when pages are defined as separate files to match the page to its entry. Also allows linking to specific pages and is more robust than using the page's array index when pages are reordered or removed.
1519

1620
### **anchor** (String, _optional_)
1721

versioned_docs/version-26.1.2/basics/structure/entries.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,39 @@ A parent connection does not imply an unlock condition or any logical dependency
142142

143143
Pages are JSON Objects that define the actual book content. See [Page Types](../page-types/page-types.md) for the available types of pages.
144144

145+
#### Pages as Files
146+
147+
By default, pages are generated as separate JSON files instead of being inline in the entry JSON. This makes it easier to manage large entries with many pages.
148+
149+
**File structure:**
150+
151+
The entry JSON lives alongside a `pages/` subdirectory that shares the entry's name:
152+
```
153+
data/<mod_id>/modonomicon/books/<book_id>/entries/
154+
<category_id>/
155+
<entry_name>.json ← entry definition (no inline pages)
156+
<entry_name>/
157+
pages/
158+
<page_id>.json ← individual page files
159+
```
160+
161+
For example, the entry `data/modonomicon/modonomicon/books/demo/entries/features/custom_icon.json`
162+
has its pages in `data/modonomicon/modonomicon/books/demo/entries/features/custom_icon/pages/`.
163+
164+
Each page file contains a single page JSON object:
165+
```json
166+
{
167+
"id": "intro",
168+
"type": "modonomicon:text",
169+
"title": "book.modonomicon.demo.features.custom_icon.intro.title",
170+
"text": "book.modonomicon.demo.features.custom_icon.intro.text"
171+
}
172+
```
173+
174+
The `id` attribute uniquely identifies the page within the entry and is used to match page files to the entry during loading. The `type` attribute determines how the page renders (e.g., `modonomicon:text`, `modonomicon:spotlight`).
175+
176+
**Datagen:** Pages-as-files is the default behavior. Use `BookEntryModel#withGeneratePagesAsFiles(false)` to generate pages inline in the entry JSON instead.
177+
145178
### **category_to_open** (ResourceLocation, _optional_)
146179

147180
The resource location to the category that should be opened when this entry is clicked.

0 commit comments

Comments
 (0)