Ox Content

ssg.ts

Source

SsgNavItem

interface

Navigation item for SSG.

Source


SsgPageData

interface

Page data for SSG.

Source


resolveSsgOptions

function

Resolves SSG options with defaults.

Source

export function resolveSsgOptions(ssg: SsgOptions | boolean | undefined): ResolvedSsgOptions

Returns

ResolvedSsgOptions -


renderTemplate

function

Simple mustache-like template rendering.

Source

function renderTemplate(template: string, data: Record<string, unknown>): string

Returns

string -


extractTitle

function

Extracts title from content or frontmatter.

Source

function extractTitle(
  content: string,
  frontmatter: Record<string, unknown>
  ): string

Returns

string -


generateNavHtml

function

Generates navigation HTML from nav groups.

Source

function generateNavHtml(navGroups: NavGroup[], currentPath: string): string

Returns

string -


generateTocHtml

function

Generates TOC HTML from toc entries.

Source

function generateTocHtml(toc: TocEntry[]): string

Returns

string -


generateBareHtmlPage

function

Generates bare HTML page (no navigation, no styles).

Source

export function generateBareHtmlPage(
  content: string,
  title: string
  ): string

Returns

string -


generateHtmlPage

function

Generates HTML page with navigation using Rust NAPI bindings.

Source


getOutputPath

function

Converts a markdown file path to its corresponding HTML output path.

Source


getUrlPath

function

Converts a markdown file path to a relative URL path.

Source

function getUrlPath(inputPath: string, srcDir: string): string

Returns

string -


getHref

function

Converts a markdown file path to an href.

Source

function getHref(inputPath: string, srcDir: string, base: string, extension: string): string

Returns

string -


getOgImagePath

function

Gets the OG image output path for a given markdown file.

Source

function getOgImagePath(inputPath: string, srcDir: string, outDir: string): string

Returns

string -


getOgImageUrl

function

Gets the OG image URL for use in meta tags. If siteUrl is provided, returns an absolute URL (required for SNS sharing).

Source

function getOgImageUrl(inputPath: string, srcDir: string, base: string, siteUrl?: string): string

Returns

string -


getDisplayTitle

function

Gets display title from file path.

Source

function getDisplayTitle(filePath: string): string

Returns

string -


formatTitle

function

Formats a file/dir name as a title.

Source

function formatTitle(name: string): string

Returns

string -


collectMarkdownFiles

function

Collects all markdown files from the source directory.

Source

export async function collectMarkdownFiles(srcDir: string): Promise<string[]>

Returns

Promise<string[]> -


NavGroup

interface

Navigation group for hierarchical navigation.

Source


buildNavItems

function

Builds navigation items from markdown files, grouped by directory.

Source


buildSsg

function

Builds all markdown files to static HTML.

Source

export async function buildSsg(
  options: ResolvedOptions,
  root: string
  ): Promise<

Returns

Promise< -