Skip to content

Configuration

Alejandro edited this page Mar 1, 2025 · 6 revisions

Configuration Reference

Norgolith uses a norgolith.toml file to manage site-wide settings, content schemas, and validation rules. This guide will walk you through all the configuration options and how to use them effectively.

Core Settings

The norgolith.toml file starts with core settings that define your site's basic properties.

Example: Core Settings

# Required
rootUrl = "https://myblog.com"
title = "My Awesome Blog"
language = "en-US"

# Optional yet recommended
author = "Jane Doe"
description = "A blog about Norgolith and static site generation"

Key Fields

  • rootUrl: The base URL for your site (used for generating absolute links in production).
  • title: The title of your site.
  • language: The language code (e.g., en-US).
  • author: The default author for all content.
  • description: A short description of your site.

Content Schemas

Content schemas allow you to define and enforce metadata structure for your Norg files. This ensures consistency across your content.

Example: Basic Content Schema

[content_schema]
required = ["title", "authors"]

[content_schema.fields.title]
type = "string"
max_length = 80

[content_schema.fields.authors]
type = "array"
min_items = 1

Key Components

  1. Required fields: List of fields that must be present in every Norg file.
  2. Field definitions: Rules for validating individual fields.
  3. Validation Rules: Conditional logic for enforcing additional constraints.

For a detailed guide on content schemas, see the Content Schemas Guide.

Syntax Highlighting

Norgolith supports syntax highlighting for code blocks in your content. You can configure it in the `[highlighter] section.

Example: Syntax Highlighting Configuration

[highlighter]
enable = true
engine = "prism"  # or "hljs"

Options

  • enable: Enable or disable syntax highlighting. false by default.
  • engine : Choose between prism (default) or hljs.

Practical Examples

Example 1: Blog Configuration

title = "My Blog"
language = "en-US"
author = "Jane Doe"

[content_schema]
required = ["title", "author", "created_at"]

[content_schema.fields.title]
type = "string"
max_length = 120

[content_schema.fields.author]
type = "string"

[content_schema.posts.rules]
if = { draft = false }
then = { required = ["publish_date"] }

[highlighter]
enable = true
engine = "prism"

Next Steps

  • Learn how to customize your site's appearance in the Theming Guide.
  • Explore advanced content validation in the Content Schemas Guide.
  • Refer to the [Commands Reference] for all available CLI options.

Clone this wiki locally