Home

Adding Templating

07/01/2023

Now that I have a basic flow of upload markdown > extract metadata > send SQS message > convert to HTML > write to destination bucket, I think it's time to add some basic templating so that I can create a more realistic website.

For Bascule I used JKnack Handlebars for the templates - I'll likely do the same again, but first a little research.

Alternatives include KorTE, from the maker of the KorGE game engine, Liquid, Moustache and more. I am looking for an engine with a native Kotlin or Java implementation, a fairly plain syntax, and few dependencies. I'd also like one under active development, and documented.

I will reject purely logic-less templating with Moustache, as I feel they are too limiting. Bigger engines like Thymeleaf are much more than I need. So I think it's between Handlebars and KorTE.

In bascule, I wrote two extension functions for handlebars - a date/time formatter, a complicated pagination helper, and a modified forEach loop.

Given my familiarity with Handlebars, and the lack of documentation around KorTE, I will stick with what I know.

One open question - is templating a separate step from markdown processing, or does it all go together?

I really need to start thinking about the project-wide metadata too, and building the project tree/hierarchy, for navigation purposes.

Going with distinct, it is more micro-service-y and makes for smaller lambdas. I'll start by moving the output of the markdown processor back to the source bucket.

How will I know when it's done?

How do I know that the processing of all the uploaded files is complete? How, indeed, do I know that there have been multiple files uploaded at all?

Even the development process is a little odd - there's no UI at all. All I do to test is upload a markdown file to S3, then watch the logs, the message queues, and check the output file in the bucket...

Prev: Progress Update 06/01/2023 Next: DynamoDB Migration Complete