Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

BookAtlas.Generator: the static site generator

generate:site <export-directory> --output-directory <dir> [--clean] [--with-pdf] [--with-map <map-directory> [--map-cdn-url <url>]] [--base-url <url>]
generate:pdf <export-directory> --output-directory <dir> [--clean]

BookAtlas.Generator turns what export:books writes into the static Book Atlas site: a language picker, then one subsite per language with an index and one page per book.

It references neither BookAtlas.Exporter nor CreationEngineFormats. It reads only the JSON contracts, book export format and map export format, with its own model types (Import/). Any export that matches the contract works, and only a contract change can break the generator.

Input

The export directory holds export.json (the manifest, whose load order the about page shows), textures/, and one localized/<language>/ folder per language with its index.json, one JSON file per book and a fonts/ folder.

Command

dotnet run --project BookAtlas.Generator -- \
  generate:site path/to/exported --output-directory ./site

--clean empties ./site first, so books dropped from the export leave no stale page. It is refused when ./site holds the export or the map directory.

A language without index.json or a book file that doesn’t parse is skipped with a warning, and an image not in textures/ shows as text. An index.json that doesn’t parse, or no language left, is an error. A missing book field is not an error: the page shows “(none)” or “(no content)”. An index only links pages that were written.

Site structure

<output-directory>/
  index.html                                   map link, then the language picker
  about.html                                   options and load order of each export, see About page
  404.html                                     page for unknown URLs, see Not found page
  style.<hash>.css                             see Styling
  robots.txt, sitemap.xml                      see Search engines
  textures/                                    copy of the export's textures/
  maps/                                        with --with-map, see Maps
    index.html, embed.html, <tiles path>
  <language-slug>/
    index.html                                 the books, sorted, with a search box
    <owningPlugin>_<localId>_<editorId>.html   one page per book
    <owningPlugin>_<localId>_<editorId>.pdf    with --with-pdf, see PDF export
    fonts/                                     copy of the language's fonts/

A language’s slug is its localized/ folder name. A book’s file name comes from its FormId, with the EditorID as a readable suffix, never from its title, so a title fix never changes a URL (Rendering/BookFileNaming.cs). Each part goes through an allowlist (letters, digits, ., _, -; unknown when nothing is left), and a numeric suffix settles a collision, which a valid export never has.

Language index

Books are sorted by title as written, <Alias=Home> placeholders included (Rendering/TitleSortKey.cs):

  • numbers by value: “9e sermon” before “10e sermon”;
  • case and the accents of the game’s Latin-script languages ignored: É with E, Œ as OE;
  • kanji by code point: the export has no reading for them;
  • equal titles by file name.

The search box filters by title or GlobalFormId (skyrim.esm:0B7736, or part of it), ignoring case and accents. Under it, a folded Advanced search has one dropdown of checkboxes per filter: Plugin (the book’s owning plugin), Type (book or note) and Teaches (skill or spell). Values checked in one dropdown add up, dropdowns narrow each other, and the count shows how many books match. A filter shows only when it splits the list, a book without a value being a part of its own: the vanilla game types every book as a book, so Type shows only with a mod that adds notes. Both need JavaScript and are hidden without it.

About page

about.html shows the options and the load order of each export, from the optional meta and the loadOrder (see Export meta): first the book export’s, from export.json, then each map’s, from its manifest, folded under its EditorID, GlobalFormId and name. A map’s options and load order are its own and can differ from the books’. The plugins and archives are folded under their count; without meta, there are no options. Every site page links about.html from its footer, the PDF excepted.

Not found page

404.html is the page a static host serves for an unknown URL. It links the stylesheet, the language picker and about.html. Without --base-url those links are relative, so they resolve only when the 404 is served from the site’s root. With --base-url, they are absolute. The page is left out of sitemap.xml and carries noindex.

Search engines

robots.txt allows every crawler. --base-url https://example.com/books/ also writes a sitemap.xml (sitemaps.org), points robots.txt at it, and gives the pages the absolute URLs that search engines and link previews need.

ItemBehavior
Base URLAbsolute http or https, no query or fragment; a trailing / is added. Anything else fails before writing
URLs listedRoot index, about.html, language indexes, book pages, PDFs written, maps/index.html. Not textures nor maps/embed.html
<lastmod>None: the export has no date per book
Over 50,000 URLssitemap.xml becomes an index over sitemap-1.xml, sitemap-2.xml, …
CanonicalEvery listed page except PDFs, as <link rel="canonical"> and og:url, the same URL as the sitemap’s. maps/embed.html is noindex and has none
Preview imageA book page’s og:image is its inventory image, when it has one
LanguagesA book page in several languages lists each as <link rel="alternate" hreflang>, itself included. A language without a tag is left out

Maps

--with-map <map-directory> adds maps/index.html, the worldspace maps in Leaflet, and maps/embed.html, the map alone for the book pages. The map directory is what export:worldspace-maps:lod or raster-records write, or an index you write by hand to combine several runs. Import/MapCatalog.cs applies the format’s consumer rules.

The navigation bar of the root index, about.html, the language indexes and the book pages links maps/index.html on its right.

maps.json and the manifests are read before any book; the tiles are copied after the books, to the same relative path under maps/. A map with levels gets the tiles of each level it keeps copied the same way, and the page data lists each level with its label, altitude and tile URL (under --map-cdn-url when given).

A map or a level the consumer rules drop is counted in one warning, each reason at --verbose. A missing maps.json, or no map kept, is an error; the books are still written.

The page’s left column has a Search tab (the worldspaces, each child under its parent) and a Metadata tab (the current map: identity, flags, size, render, then folded its children, the plugins that carry the worldspace, its levels and the markers). The map’s load order and export options are on the About page. The levels list the map’s own tiles as level 0, top, then each level in index order with its tiles and altitude. You resize the column by dragging its border or with the arrow keys on it; the browser keeps the width. In a narrow window the column sits above the map and its list shows about seven worldspaces, the rest under a scrollbar.

Without JavaScript the column splits in half, the worldspaces above the metadata of every map, and a note takes the map’s place. A worldspace link then leaves that map’s metadata alone.

Both pages take the view from the URL:

ParameterMeaningMissing or invalid
worldspaceEditorID, case-insensitiveTamriel when listed, else the first map
x, yCenter in game unitsWhole map fitted
zoomLeaflet zoom, clamped to minZoom..maxZoom + 3Whole map fitted
zAltitude in game units: the level of the lowest stop at or above it, the top above every stop. Only for a map with levelsTop of the slider

Game units keep a link valid after a re-export at another resolution. Moving updates the URL; switching worldspace adds a history entry.

A map with levels shows an altitude slider on both pages, one stop per level, top for the map’s own tiles. Every level is a hidden tile layer added when the map opens: switching level changes opacities and loads nothing, so a map with many levels costs more requests on first view. Markers outside their levels are dimmed, and a disabled one is drawn fainter. Each group of markers is a layer of its own, off at first when its defaultVisible is false. A level without an altitude is left out of the slider; a map with none left has no slider and no z.

A book location in a mapped worldspace gets a folded Map: maps/embed.html in a lazy iframe, centered on it two levels under the map’s maxZoom (Rendering/Maps/MapLinks.cs), and a link to the full page. Interiors and unmapped worldspaces get none.

The libraries are pinned CDN URLs with a sha384 integrity hash (Rendering/Maps/MapLibraries.cs): Leaflet, Leaflet-MiniMap, and pmtiles when a map is an archive. To update one, change its URL and its hash:

curl -fsSL <url> | openssl dgst -sha384 -binary | base64 -w0

A .pmtiles archive needs a server that answers Range requests. The dev shell’s serve runs Caddy with Range requests and CORS: nix develop --command serve ./site 8080.

Tiles served elsewhere

A full-resolution map directory weighs hundreds of gigabytes. When its tiles are already served, --map-cdn-url https://cdn.example.com/maps/ copies none: the pages load <url><tiles path>. --with-map is still needed for maps.json and the manifests, and each map’s tiles must still exist on disk. The URL follows the same rules as the sitemap’s base URL. For a .pmtiles archive the server must answer Range requests and send Access-Control-Allow-Origin. To try it locally, serve path/to/maps 8081 and pass --map-cdn-url http://127.0.0.1:8081/.