TOML Data Demo

Using structured data in SSI

Version 1.0 by SSI Team

TOML as a Data Source

Store variables, configuration, and structured data in TOML files for clean separation of data and presentation.

Key Features

🔑 Key-Value Storage

Store data in simple, readable TOML format

📊 Structured Data

Organize information in tables and sections

🔄 Easy Updates

Change data without touching templates

🛡️ Type Safety

Plain text automatically escaped for security

Why Use TOML?

How It Works

The code blocks below are themselves SSI includes — each one is an HTML file in code-examples/ containing a <pre><code> block. The text-indent CSS rule aligns the first line with the rest: SSI places the first line of an included file inline (right after the opening tag) while continuation lines get the token line's leading whitespace prepended. text-indent: 2ch shifts the first line forward to match.

1. Create a TOML file:

[_]
  site_name = "TOML Data Demo"
  author = "SSI Team"
  version = "1.0"
  build_year = "🕒year"

2. Configure in ssi-config.toml:

[[step]]
  emoji = "📊"
  path = "data.toml"
  processing = "include"
  type = "plain"
  options = ["inline"]

3. Use tokens in your templates:

<h1>📊site_name</h1>
<p>By 📊author</p>
<p>Version 📊version</p>

💡 This Page Uses TOML

Every piece of text you see on this page comes from data.toml! The template is pure structure, while the content lives in the TOML file.

Try opening site/data.toml and changing values, then regenerate the site to see your changes.

Good Use Cases

🌐 Site Configuration

Store site name, author, version, contact info in one place

📝 Content Variables

Repeated text like license notices, company names, dates

🎨 Theme Settings

Colors, fonts, and styling values (though CSS is better for most)

📊 Structured Data

Lists, tables, and organized information