indexToObject
For static sites, you can pre-generate indices with SSG during build time to optimize page load performance:
Type Definition
Section titled “Type Definition”function indexToObject(index: StaticSeekIndex): StaticSeekIndexObject;Parameters
Section titled “Parameters”index: AStaticSeekIndexobject that represents the index you want to convert to a JSON-compatible format.
Return Value
Section titled “Return Value”The function returns a StaticSeekIndexObject, a JavaScript object.
import { createIndex, LinearIndex, StaticSeekError, indexToObject } from "staticseek";
const index = createIndex(LinearIndex, array_of_articles);if (index instanceof StaticSeekError) throw index;const json = JSON.stringify(indexToObject(index));// Write the json to a file and upload it to the host