A simple Gleam blog generator.
Find a file
2024-04-20 11:28:54 +03:00
priv Fix code blocks, make layout better 2024-04-19 23:48:35 +03:00
src Bump to Gleam 1.1.0 2024-04-20 11:28:54 +03:00
test Initial commit of rewritten version 2024-04-04 14:44:37 +03:00
.gitignore Initial commit of rewritten version 2024-04-04 14:44:37 +03:00
.tool-versions Bump to Gleam 1.1.0 2024-04-20 11:28:54 +03:00
gleam.toml Bump to Gleam 1.1.0 2024-04-20 11:28:54 +03:00
LICENSE.txt Add licenses 2024-04-07 20:34:31 +03:00
manifest.toml Add docs and move stuff to internal 2024-04-19 23:48:49 +03:00
README.md Add even more docs 2024-04-20 11:25:02 +03:00

gloss

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

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

Quickstart

Gloss is not yet available on Hex. You can use it with a path dependency instead. Create a new Gleam project and add the following to gleam.toml:

[dependencies]
gleam_stdlib = "~> 0.36 or ~> 1.0"
gloss = { path = "../path/to/gloss" }

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

import gleam/result
import gleam/option
import gleam/io
import gloss/builder
import gloss/config.{type Configuration, Configuration}
import gloss/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)
}

Documentation