Jan-Lukas Else

Thoughts of an IT expert

Back To Static - And How I Made Forms Working

Published on in 👨‍💻 Dev
Updated on
Short link: https://b.jlel.se/s/203
⚠️ This entry is already over one year old. It may no longer be up to date. Opinions may have changed. When I wrote this post, I was only 18 years old!
AI generated summary: The blog post discusses the author's switch from using Pagekit to a static site setup with Hugo, and how they found a solution for contact forms without exposing their email by creating a self-hosted NodeJS service called Maily-Form.

I used Pagekit for quite some time with my personal homepage. Pagekit gave me a nice Admin UI and there were also nice themes and plugins, which I could use. But Pagekit is PHP and the setup isn’t that optimal. So I switched back to a static site setup with Hugo.

Some years ago I used Jekyll to build a lot of websites. Jekyll was really easy to use and you could host your sites on GitHub for free, I didn’t rent a server yet back then.

But there’s also an alternative called Hugo.

Hugo is like Jekyll but build with Go, a modern programming language, which is also used for Gitea and a lot of other things. With Hugo you create Markdown files for your content and the HTML will be generated automatically. To learn more about it read here.

But one reason I used a non-static setup was the option to have contact forms without the need to expose your email. A simple way for people to send you messages without needing them to write you an email. But I found a solution for that:

You propably know Formspree or a similiar service. They offer you the possibility to just use a standard HTML form on your page and they handle the messages and send them to you via mail, so you don’t need to manage a database and all that stuff yourself.

I build something like a clone of it, but for self-hosting. Maily-Form is a simple NodeJS service, which you can host with Docker. It accepts POST requests from forms and sends them directly via SMTP to your email address it also doesn’t store any data, so you should be on the safe site (I’m hearing GDPR everywhere). You can choose your own SMTP provider (I use FastMail), so you don’t have to pay for another service like MailGun.

This way the only dynamic module is the form handler, but that uses just like 10 MB memory, doesn’t need PHP and I can use it for multiple sites and forms. Using a static homepage not only increases speed, it may also reduce server load or offer you the possibility to even use GithHub pages again.

Tags: , , , , , , ,

Jan-Lukas Else
Interactions & Comments