Open-source tool to make a static blog in OCaml?

Hello,

I would like to make a static blog, i.e. locally generated HTML and CSS files and then uploaded on the web server.

I have following minimal requirements:

  • FLOSS tool in OCaml
  • Tool easy to install from opam
  • Ready to use by default, any cosmetic configuration can be done later. I’m not much interested in visual appearance even if I’ll probably do my own tweaking at some point
  • Input in markdown format with images (my previous blog was with Dotclear and I have a conversion of the posts in Hugo format)
  • Ability to pretty print code would be a plus
  • Tagging system on each blog post
  • Date on each blog post
  • Sensible URL generation scheme, possible tweaking would be a plus
  • Ability to have draft blog posts would be a plus
  • Ability to publish blog posts at a given date would be a plus
  • Local rendering to check blog result, in automatic update mode if possible
  • Ability to generate indexes by year, tag, …
  • Good performance (low rendering time, rendering only modified content, …) would be a plus

I probably could do my own system but I’m pretty sure it already exists. :wink: Any suggestions?

Thanks!
David

1 Like

https://soupault.app

5 Likes

I vote for Soupault too.

The documentation is pretty detailed.

Great support.

It should pretty much cover most (or all?) of your requirements. You have to go through the docs to figure out how.

Ready to use by default, any cosmetic configuration can be done later. I’m not much interested in visual appearance even if I’ll probably do my own tweaking at some point

Yes this exists. Your styling tweaks would involve only plain old CSS, nothing else.

6 Likes

There’s YOCaml.

5 Likes

And you can also deploy a mini operating system (Gcloud for instance) which delivers your static blog as I do here.

4 Likes

Thank you the pointers. Both Soupault and YOCaml seem quite complicated. At least this is not what I considered. :wink: I’ll look at them in more details.

If you’re looking for a simpler approach, you can probably get by by writing your own as a bespoke generator (framed as an alternative to making a general purpose framework/tool).

For example, the PLSE website at my university (nus-plse.github.io) is a static site automatically generated using OCaml, and using yaml and markdown as input.

At the root of the project, I have a dune-file which copies over static files and invokes a “generator.exe” binary that will walk a data directory (containing yaml files) and generate corresponding static files in the output directory:

(rule
 (alias all)
 (deps (sandbox always) (glob_files_rec static/*) (glob_files_rec data/*) favicon.ico)
 (targets (dir web))
 (action
  (progn
   (bash "mkdir web")
   (bash "cp favicon.ico web/")
   (bash "cp -lR ./static/ ./web/static/")
   (run ./src/generator/generator.exe "./data" "./web")
)))

All in all, it took me a couple of days to write the whole thing, and it’s been running without problem for ~2 years now (even now that the maintenance of the data on the site is handled by others).

My tool finch meets most of these requirements. I think it is much more Hugo/Jekyll-like than YOCaml or Soupault. It should be easy for you to add any features you need, it’s <600 lines of straightforward OCaml.

Two examples of its use are its documentation and my meagre website.

2 Likes

Thank you @roddy, that really looks to what I’m looking for! I’ll test it.

And thank you @Gopiandcode, for the Dune example. I’m very new to Dune and find interesting that we can do such things.

1 Like

Html_of_wiki has lots of these features