Skip to content
KB4IT Help

Build and rebuild a website

How-to guide Building basic
On this page

Build

Point kb4it build at the settings file of the knowledge base:

kb4it build ~/mykb/config/repo.json

Or run the script kb4it create made for you: ~/mykb/bin/compile.sh on Linux and macOS, mykb\bin\compile.cmd on Windows.

The website is written to the target/ folder. Open target/index.html in a browser, or see Publish on any web server to share it.

Read the summary

Every build ends with a summary line:

[WORKFLOW] SUMMARY docs_total=120 compiled=3 skipped=116 invalid=1 keys_compiled=2 kv_pages_compiled=5
Field Meaning
docs_total Documents found in source/
compiled Documents converted in this build
skipped Unchanged documents reused from the last build
invalid Documents KB4IT could not read; why
keys_compiled, kv_pages_compiled Property pages refreshed

Rebuild after a change

Run the same command again. KB4IT compares every document with the last build and compiles only the ones you changed, added or removed, plus the property pages they appear on.

A change to repo.json that can show on a page, such as title or a theme option, rebuilds every page. workers, force, fail_on_invalid, source and target never reach a page, so changing them rebuilds nothing.

Rebuild everything

kb4it build --force ~/mykb/config/repo.json

Use it after you change a template of your own theme, or when the site looks out of date. --force deletes KB4IT's cache in var/; it never touches source/ or target/.

Check documents without building

kb4it verify ~/mykb/config/repo.json

It reads every document and lists those KB4IT cannot use, with the reason. Some themes add their own checks here; apphelp, for example, checks its required properties. The command exits with status 1 when it finds a problem, so you can run it in CI or in a git hook.

See more detail

kb4it -L DEBUG build ~/mykb/config/repo.json

-L takes DEBUG, INFO (the default), WARNING or ERROR, and sets what the terminal shows. The log file always gets every line, debug included: the log of the last build is var/log/kb4it.log inside the knowledge base, and the three before it are kb4it.log.old, kb4it.log.old.2 and kb4it.log.old.3. When a command fails, its last line names the log file: Log: <path>. When a command fails before it reaches the knowledge base, for example because repo.json cannot be read, its log stays in ~/.kb4it/var/log/ as kb4it.log.<number>; KB4IT removes those files after 7 days.

Make large builds faster

KB4IT converts several documents at a time, by default half the number of processor cores. Change it with "workers" in repo.json. Use fewer workers if the computer runs short of memory.

Note

Only one KB4IT builds a knowledge base at a time. A second build of the same knowledge base stops with KB4IT is already working on this repository (PID 1234). Different knowledge bases can build at the same time.