gemoire: yet another static gemlog generator

[ gemini, gpl, library ] [ Propose Tags ] [ Report a vulnerability ]

gemoire is just another take on a static gemlog generator with feeds trying to be flexible just enough, configured and served using Haskell. See the README.md for usage examples and Hackage for a detailed documentation.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0
Change log ChangeLog.md
Dependencies base (>=4.16 && <5), directory (>=1.3.7 && <1.4), extra (>=1.7.12 && <1.9), filepath (>=1.4.100.4 && <1.6), gemmula (>=1.2 && <1.3), text (>=2.0 && <2.2), time (>=1.12 && <1.15), unordered-containers (>=0.2.18 && <0.2.21) [details]
Tested with ghc ==9.6.6, ghc ==9.8.4, ghc ==9.10.1
License GPL-3.0-or-later
Copyright (c) Sena 2024
Author Sena <contact@sena.pink>
Maintainer contact@sena.pink
Category Gemini
Home page https://codeberg.org/sena/gemoire
Bug tracker https://codeberg.org/sena/gemoire/issues
Source repo head: git clone https://codeberg.org/sena/gemoire
Uploaded by jan_sena at 2025-01-25T17:47:04Z
Distributions
Downloads 11 total (11 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2025-01-25 [all 1 reports]

Readme for gemoire-0.1.0

[back to package description]

gemoire - yet another static gemlog generator

gemoire is just a basic flexible gemini blog generator, that can:

  • be configured using Haskell code,
  • use custom templates written in an authentic syntax,
  • set additional and overriding variables for formatting,
  • and generate Atom and Gemini feeds.

See the example directory in the repository to see how it looks like in "production".

Getting Started

Intended way for using gemoire is through Cabal scripts. To get started, you should organize your gemlog sources like so:

gemlog
├── content
│   ├── post1.gmi
│   └── post2.gmi
└── gemlog.hs

The contents directory can be as deep as you want, all posts will end up in a flat directory in the end. After setting up your files, you can start configuring your gemlog.hs, here is a simple template for you using the defaults:

#!/usr/bin/env cabal
{- cabal:
build-depends: base
             , gemoire
-}
{-# LANGUAGE OverloadedStrings #-}

import Gemoire

main :: IO ()
main = do
    let gemlog =
            Gemlog
                { title = "my gemlog"
                , author = "me"
                , sourceDir = "content"
                , baseURL = "gemini://my.website.com/path/to/gemlog"
                , postTemplate = defPost
                , gemfeedTemplates =
                      ( defGemfeed
                      , defGemfeedEntry
                      )
                , atomTemplates =
                      ( defAtom
                      , defAtomEntry
                      )
                , overrides = vempty
                }

    generatePosts gemlog "~/public_gemini/path/to/gemlog"
    generateGemfeed gemlog "~/public_gemini/path/to/gemlog/index.gmi"
    generateAtom gemlog "~/public_gemini/path/to/gemlog/atom.xml"

After setting up your configuration, you can just cd into the gemlog directory and run the generator:

$ cabal run gemlog.hs

If Cabal is causing problems, you can just install the library and use runghc instead, like so:

$ cabal install --lib gemoire
$ runghc gemlog.hs

Customizing

You can then customize your gemlog to your liking. To do that, you might want to start with changing the templates, like so:

#!/usr/bin/env cabal
{- cabal:
build-depends: base
             , text
             , gemoire
-}
{-# LANGUAGE OverloadedStrings #-}

-- gemoire uses Data.Text underhood.
import Data.Text (unlines)
import Prelude hiding (unlines)
import Gemoire

-- The line endings will be taken care of by gemoire.
-- ...
                , postTemplate = template . unlines $
                      [ "By {$author$}."
                      , ""
                      , "{$post$}"
                      ]
-- ...

There are various variables and different useful compounds you can use in the templates. A detailed list can be found in the documentation of Gemoire.Template. Also check the default templates in the source for some inspiration!

Different special variables are available to the formatters for feeds and posts. You can see a list of those and how you can set overrides per post in the page for Gemoire.Gemlog.

Additionally, you can set overriding variables globally using the overrides variable, like so:

-- ...
                , overrides = vlist
                      [ ("variable", "new value")
                      , ("another", "overridden")
                      ]
-- ...

See also