A simple Gleam blog generator.
Find a file
2024-06-01 08:56:00 +03:00
priv Add gettext support 2024-06-01 08:53:02 +03:00
src Add gettext support 2024-06-01 08:53:02 +03:00
test Initial commit of rewritten version 2024-04-04 14:44:37 +03:00
.gitignore Add gettext support 2024-06-01 08:53:02 +03:00
.tool-versions Bump to Gleam 1.1.0 2024-04-20 11:28:54 +03:00
CHANGELOG.md Update changelog 2024-06-01 08:53:23 +03:00
gleam.toml Update to published lustre_ssg 2024-06-01 08:56:00 +03:00
LICENSE.txt Rename project 2024-04-20 23:05:11 +03:00
manifest.toml Update to published lustre_ssg 2024-06-01 08:56:00 +03:00
README.md Add docs and fix for latest lustre_ssg 2024-04-21 08:41:19 +03:00

scriptorium

Scriptorium is a simple blog generator for Gleam, using Lustre and lustre_ssg.

Scriptorium runs on the JavaScript target and it's tested with Node.js.

Package Version Hex Docs

Quickstart

To use Scriptorium, you will need to create a new Gleam project and add Scriptorium as a dependency.

gleam add scriptorium

To generate a default blog, use the following in your main file:

import gleam/result
import gleam/option
import gleam/io
import scriptorium/builder
import scriptorium/config.{type Configuration, Configuration}
import scriptorium/defaults

pub fn main() {
  let config =
    defaults.default_config(
      "My Blog",
      "https://my.blog.example/",
      "en",
      config.Author(
        "Person McPerson",
        option.Some("person@example.com"),
        option.Some("https://fedi.instance.example/@person"),
      ),
      "© Person McPerson",
    )

  io.debug(build(config))
}

pub fn build(config: Configuration) {
  // Parse the files
  use db <- result.try(builder.parse(config))
  // Compile Markdown into HTML
  let compiled = builder.compile(db, config)
  // Render content into Lustre elements
  let rendered = builder.render(db, compiled, config)
  // Write rendered content into the filesystem
  builder.write(rendered, config)
}

Now you will need to add source files. Create the following directory tree in the root of the project folder:

your_project
└── data
    ├── pages
    └── posts

In ./data/posts, create a file 2024-04-21-hello-world.md with the following contents:

Hello, World!
meta

This is the first blog entry.

Then run gleam run --target javascript to build the blog and see what was generated in ./output.

For further usage help, see the documentation as described below.

Documentation