GenieStatic - static website generator for Genie apps #675
essenciary
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@vrkansagara @PGimenez Starting a discussion here to collect ideas and specs for the static website generator.
The way I see it:
we need to leverage Genie's strength. That is, the ability to create dynamic websites of any complexity, using whatever data backends and data access strategies we support. Meaning that we should not focus on, for example, markdown files (this use case is covered by Franklin anyway). But rather, allow any dynamic Genie website to be exported as a static website. Such a website could use dynamic pages based on database data, accessing REST APIs, reading files from the file system, etc.
these features should be "extra" - so not part of Genie core. We'll provide them via an extra package (ex
GenieStatic
).in terms of API, IMO the most straightforward way is to:
a) extend/specialize the
routes
method inGenie.Router
so that routes that are meant to be exported as static pages retrieve an extra param: an iterator that letsGenieStatic
know how to build the static pages.Example: say we have
route("/products/:id", ProductsController.get)
. We would extend this asroute("/products/:id", ProductsController.get, SearchLight.all(Product))
.b) then we add a
GenieStatic.build(config...)
that goes throughRouter.routes()
and requests all the pages using the provided iterator, and dumps the output in a folder - that's the static website.PS1 - of course, the logic will become a lot more complex when we have multiple route placeholders, like:
route("/blogs/:blog_id/comments/:comment_id", BlogsCommentsController.get)
. One way to approach this could beroute("/blogs/:blog_id/comments/:comment_id", BlogsCommentsController.get; static = ( (blog_id, comment_id) for blog_id in SearchLight.all(Blog), comment_id in SearchLight.all(Comment, where=["blog_id = ?", blog_id]) )
.PS2 - as a future project, we can build an admin area / CMS for editing "pages".
Beta Was this translation helpful? Give feedback.
All reactions