Genie.jl icon indicating copy to clipboard operation
Genie.jl copied to clipboard

Genie as Static site generator

Open schlichtanders opened this issue 2 years ago • 4 comments

Problem description

I am currently using Franklin to create my static website, however this comes with a couple of downsides which a pure julia Genie version would simplify I think.

Core components I use for creating my static sides:

  • write markdown
  • write html
  • write/insert html within markdown
  • write/insert markdown within html
  • everywhere syntax highlighting for markdown
  • everywhere syntax highlighting for html
  • everywhere vscode autocompletion for html (I am using tailwindcss, where this is especially useful)
  • the static webpage needs to be hostable on github/gitlab pages
  • github actions / gitlab cicd for automatic deployment on github/gitlab pages
  • live server for development which updates immediately if something changes

Difficulties when using Franklin:

  • many different languages for abstracting (latex commands, html special functions, plain julia)
  • many ways of inserting one language into another
  • syntax highlighting does not work always
  • autocompletion does not work always

My wish for simplifying the toolset:

  • use julia for abstractions
  • use julia string macros for defining markdown/html (should easily provide syntax highlighting and autocompletion everywhere)
  • use julia interpolation for switching between different formats and abstractions

Solution sketch

What it needs:

  • Genie's approach is mostly pure julia and hence very well fulfills this
  • VSCode julia-extension needs to add highlighting support for all standard html/markdown string macros, but this should be rather easy, I hope.
  • Genie needs to be able to create static website from the routes.jl configuration.
  • github/gitlab cicd scripts which do this website creation automatically on push and compatible with github/gitlab pages respectively

Really nice to have extra:

  • showcase how to setup a multi-language static website, e.g. with English and German.
  • EDIT ADDED: good error handling for development, i.e. that genie server is not killed by having a corrupt julia file, but rather points me to the place where I need to change something.

Alternatives considered

  • I am using Franklin.jl right now, which tries to be more markup oriented than relying on pure julia.
  • I took a short look at StaticWebPages.jl, however it seems to be more object oriented and as such restricting the concrete abstractions you should use (I have not really tried this package though)
  • I know about Genie.jl being even way more powerful, hence in case I would like to extend my static website to a full webserver, that would be much easier from Genie to Genie than switching from Franklin to Genie.

schlichtanders avatar Nov 05 '21 12:11 schlichtanders

Why not collaborate with @tlienart on Franklin.jl to address these issues? Thibaut is very open to contributions

rikhuijzer avatar Nov 10 '21 13:11 rikhuijzer

Franklin has a different approach as far as I understood it. More markdown focussed.

As described, I myself am looking more for a julia focussed static site builder. In addition, the question was also briefly asked on genie gitter where @essenciary asked to create an issue like this for it. So there also seems to be interest from Genie for static site generation.

schlichtanders avatar Nov 10 '21 14:11 schlichtanders

To be fair to @schlichtanders, he did give a lot of useful feedback over at Franklin.jl. I think the points raised as difficulties for Franklin are unlikely to get solved easily:

  • highlighting (here what Sam means is that your markdown gets properly highlighted in the editor, specifically the HTML as most of the rest gets highlighted properly) this would require to write a description of the Franklin-specific Markdown and have that available for popular editors like Atom/VS-Code, not impossible to do but not on my priority list (though I'd gladly help someone willing to work on this)
  • autocompletion, here I'm not sure what is meant but I guess it's also an editor-level thing and also not something I'm planning to work on soon; Atom does some autocompletion (with keywords that it's seen before) by default in all files which I imagine VS code does too but maybe it's something more specific that is meant here.
  • the other two points are kind of 'by design' now for better or worse

so if those points matter to a user, and if that's addressed by Genie or some other framework, then that's a win for users who get more choice!

tlienart avatar Nov 10 '21 14:11 tlienart

Our short term goal is to provide a way to export Genie websites as static web pages. Basically to allow decoupling the backend of a Genie app. It's very appealing to have the full power of a web framework without having to pay for the server. With the exception of a dedicated Genie VSCode extension (which is not planned soon but it's something we'd really like to have at some point), I'd say that the features are already there.

I see this as a solution complementary to Franklin in the sense that it will target Genie users which are comfortable working with a full MVC framework, use databases for dynamic generation of content, etc. If we take into account the plugin ecosystem, we could even export Stipple based reactive data dashboards as static webpages (as long as they don't need to update the data from the server).

essenciary avatar Nov 10 '21 14:11 essenciary