Super-Simple Includes Documentation

v0.244.0

Per-Page Tokens

Per-Page Tokens

Per-page token resolution lets the same token resolve to different content depending on which page is being processed. This happens automatically for all include sources — no special configuration required.

How It Works

When SSI processes a template file (e.g., about.html), it:

  1. Extracts the page name from the filename: about.htmlabout
  2. Looks for page-specific content in a subdirectory or TOML table matching that name
  3. Falls back to the default content if no page-specific version exists

Page-specific content takes complete precedence over the default — there is no merging. Either a page-specific file/table entry exists (used exclusively) or it does not (default used).

Directory Source Example

content/
                ├── title.txt          # default title (used by any page without its own)
                ├── about/
                │   └── title.txt      # used only for about.html
                └── contact/
                    └── title.txt      # used only for contact.html
                

TOML Source Example

# strings.toml
                [_]
                title = "My Site"       # default
                
                [about]
                title = "About Us"      # used only for about.html
                
                [contact]
                title = "Contact"       # used only for contact.html
                

Context Override

To use a fixed subdirectory for all pages instead of the automatic page-name lookup, use the context field in the include step config. See ssi help include-sources for details.

See Also