Skip to main content

Crate ox_content_ssg

Crate ox_content_ssg 

Source
Expand description

Static Site Generation for Ox Content.

This crate provides HTML page generation for documentation sites, including navigation, table of contents, search functionality, and theming support.

§Features

  • Full HTML page generation with responsive layout
  • Navigation sidebar with grouping
  • Table of contents generation
  • Client-side search integration
  • Dark/light theme support
  • Mobile-friendly responsive design
  • Customizable theme configuration

§Example

use ox_content_ssg::{generate_html, PageData, NavGroup, NavItem, SsgConfig, TocEntry};

let page_data = PageData {
    title: "Getting Started".to_string(),
    description: Some("Learn how to use ox-content".to_string()),
    content: "<h1>Getting Started</h1><p>Welcome!</p>".to_string(),
    toc: vec![TocEntry { depth: 1, text: "Getting Started".to_string(), slug: "getting-started".to_string() }],
    path: "getting-started".to_string(),
    entry_page: None,
};

let nav_groups = vec![NavGroup {
    title: "Guide".to_string(),
    items: vec![NavItem {
        title: "Getting Started".to_string(),
        path: "getting-started".to_string(),
        href: "/docs/getting-started/index.html".to_string(),
    }],
}];

let config = SsgConfig {
    site_name: "My Docs".to_string(),
    base: "/docs/".to_string(),
    og_image: None,
    theme: None,
};

let html = generate_html(&page_data, &nav_groups, &config);

Structs§

EntryPageConfig
Entry page configuration (for landing pages with hero and features).
FeatureConfig
Feature card configuration.
HeroAction
Hero action button.
HeroConfig
Hero section configuration.
HeroImage
Hero image configuration.
HeroNoticeConfig
Hero notice configuration.
LocaleInfo
Locale information for the locale switcher.
NavGroup
Navigation group for SSG.
NavItem
Navigation item for SSG.
PageData
Page data for SSG.
SocialLinks
Social links configuration.
SsgConfig
SSG configuration.
ThemeColors
Theme color configuration.
ThemeConfig
Complete theme configuration.
ThemeEmbed
Embedded HTML content for specific positions in the page layout.
ThemeEntryPage
Theme configuration for entry pages.
ThemeFonts
Theme font configuration.
ThemeFooter
Theme footer configuration.
ThemeHeader
Theme header configuration.
ThemeLayout
Theme layout configuration.
TocEntry
Table of contents entry.

Functions§

generate_html
Generates a complete HTML page for SSG.