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

Genie as Static site generator #431

Open
schlichtanders opened this issue Nov 5, 2021 · 8 comments
Open

Genie as Static site generator #431

schlichtanders opened this issue Nov 5, 2021 · 8 comments
Assignees

Comments

@schlichtanders
Copy link

schlichtanders commented Nov 5, 2021

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.
@rikhuijzer
Copy link

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

@schlichtanders
Copy link
Author

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.

@tlienart
Copy link
Contributor

tlienart commented Nov 10, 2021

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!

@essenciary
Copy link
Member

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).

@ShalokShalom
Copy link

Can this be put on a milestone?

@KwatMDPhD
Copy link

I'd like to keep using Genie, export a static-website directory, and serve on GitHub pages.

@essenciary
Copy link
Member

essenciary commented Oct 3, 2024

No sure if we'll have time to tackle this soon, but if anybody wants to try, it should not be all that difficult and we'd be happy to help along the way. So if you feel adventurous and wanna contribute to Genie, ping me.

What this would entail is:
1/ create a new Genie plugin, maybe GenieStatic.jl
2/ add a method that iterates over the routes, fetches the page with HTTP.jl and saves it to file

The most difficult part, at least architecturally, would be to decide how to handle dynamic routes like users/:user_id/posts/:post_id <- how to generate all these based for example on a database (SELECT id FROM users and SELECT id FROM posts WHERE user_id = $user_id)

@KwatMDPhD
Copy link

I'll take this on. For better communication, I'll msg you on Slack. Let's do this. I appreciate Genie very much.

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

No branches or pull requests

7 participants