Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poise redesign #8

Open
5 of 24 tasks
oubiwann opened this issue Dec 26, 2023 · 0 comments
Open
5 of 24 tasks

poise redesign #8

oubiwann opened this issue Dec 26, 2023 · 0 comments
Labels
Milestone

Comments

@oubiwann
Copy link
Member

oubiwann commented Dec 26, 2023

Problem Statement

The LFE website has been using Zola for many years, and while this has been great, there are things that we would change if we could.

Item 1 - Markdown AST

we'd like to make some significant changes to how Markdown is displayed in certain parts of the site and we don't have the level of flexibility we would like. For instance, taking the headings of a certain level and all their children and rendering those in different parts of a template. To do that more simply/generally, one would like to have access to the AST of the markdown and then be able to call useful Zola or Tera template functions/built-ins on the AST (or select parts of it).

Item 2 - Pages vs. Sections

The page/section distinction that Zola makes is a little bit arbitrary and mostly useful for Zola internals (it's able to do some clever parsing/rendering parallelisation due to this abstraction). However, the downside to the user is a fair bit of confusion and a lot of unnecessary code/template duplication.

Item 3 - Template Layout Complexity

We've never really had a clean Zola template setup (possibly the root cause being "Item 2" above) and we're not really sure how to fix that without spending a great deal of time on some cleanup can can't really justify the time expenditure when what we have seems to work (if it's awkward to maintain/edit).

Item 4 - Zola and/or Tera Extensibility

A nicely extensible system would allow for us to make the above changes to it and still use the core of said system. Neither Zola nor its chosen templating system Tera offer the degree of customisation we need to accomplish our aims.

Item 5 - Clean Multi-site Capability/Workflow

This is probably possible in Zola, we just never were able to figure out a good answer in the various times we tried investigating the matter. Essentially, we'd like to be able to statically generate completely different content, templates, look-and-feel, etc., under one domain (under arbitrary paths). This would allow us to support, e.g., a "main" site, a blog, language documentation, etc.

Proposal

Direction Change

This redsign effort intentionally moves away from the inspiration provided by the Clojure-based stasis project, and instead towards something more Zola-like, but with greater simplicity and more data.

Features

  • Site generation:
    • driven by configuration
    • multi-site capable
  • Page data:
    • markdown as source, including "front matter" (metadata)
    • parsed as HTML and AST (mdast)
  • Template system:
    • erlydtl (this gives us template composition, etc., as well as custom tags/extensibility)
    • clear means of template selection in md files (e.g., front matter)
    • consistent set of variables every page has access to

Weaknesses

This approach has the following difficulties than we need to be aware of (only some of which may be surmountable):

  • LFE/Erlang are not as fast as compiled Rust, so generating a site will take longer (large sites potentially much longer)
  • Erlang does not seem to have a markdown parser that can generate mdast, so we will likely have to install and use third-party tooling via the CLI (or port calls to the OS)
  • As such, we will in all likelihood have to essentially create an in-memory "db" for each file consisting of filesystem path, front matter metadata, raw markdown, markdown AST, and parsed HTML (these + configuration data will need to be passed to the compiled Erlydtl templates)
  • Erlydtl compiles templates to Erlang bytecode, which may then have their renderfunction called to output file data ... this means there will be a compile for the templates and any custom Erlydtl tags, a compile for poise code, and then a "run" step that will need to call this code and all associated/required renderfunctions.

Work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant