Farewell Wordpress, hello Jamstack
After over 10 year using Wordpress, the world evolved and Abapinho decided it’s time to evolve with it.
Why abandon Wordpress?
Because Wordpress:
- Generates dynamic pages on the moment in PHP
- And, as such, needs a database
- And has a publicly accessible backoffice
- Which requires users and passwords
- And keeping a lot of plugins
- Like caches to make it deliver pages faster
- And hosting all this costs money
The things in the above list not only add complexity to the system but are also vulnerability points in the website’s security.
Why adopt Jackstack?
Because with Jamstack:
- The website is static, generated only once, when published
- As such there is no online database
- No backoffice
- No users
- No plugins
- No special hosting with dynamic capabilities
- Because everything is plain HTML, everything is really fast
- Without the need for a cache between the server and the browser
- And the content is hosted in a CDN
- Which makes everything even faster
- Besides, the whole content is now all Markdown em vez de HTML
- Markdown is simpler but still powerful
- And deploying it is fully automated by CI/CD
Ironically, while being a static site makes everything simpler, the tools that are used to edit, generate and deploy it are so powerful and so well integrated that the result is in every way better than with the old Wordpress.
What tools?
Editing
The site is not just a simple folder with a lot of Markdown files and some HTML templates with a some Go stuff in them. These are hosted in a GitHub private repository and can be edited locally using Visual Studio Code or online on Forestry which integrates directly with GitHub.
GitHub, Visual Studio Code and Forestry are free.
Generation
There are a lot of Static Site Generators. Jeckyl is the most famous but I chose Hugo because I found it simpler, more versatile and because it’s made in Go and I like Go. Whenever I commit to the main branch, a CI/CD pipeline is automatically triggered which executes the Hugo command to generate the whole site from the markdown and templates files.
Hugo is free.
Hosting
The site is now hosted in Netlify which is a global edge network and is automatically published to its public destination by the same CI/CD pipeline. And it even has the bonus of generating deploy previews which are a great testing tool.
Netlify is free for low traffic sites like this one.
Dynamic stuff
Even though all content is static, some things still need to be dynamic:
- Comments: I could use Disqus which is a free SaaS but they are famous for not respecting users privacyy so I chose to self-host Remark42 as a Docker container in my VPS;
- Analytics: I could use Google Analytics but I’ve now managed to mostly deGoogle my life so… I’m using Matomo instead, running it as another Docker container in my VPS;
- Search: I’m using Algolia. Every time the site is published, the CI/CD pipeline sends a JSON with the whole ontent in both Portuguese and English to Algolia which then converts it into searchable indexes. A little Javascript script in all pages calls Algolia’s API and renders the instant search textbox.
- Email notifications: Remark42 sends email notifications. For that i’m SendGrid.
Remark42 and Matomo are free. Algolia is free up to 10000 searches per month and SendGrid is free up to 100 emails/day. The VPS custs 5€/month in Contabo and I already had it running for other purposes anyway.
Conclusion
Well, I guess this explains why I haven’t been publishing much content lately. I decided to not touch the design for now so that I couuld tackle one thing at a time. But sooner or later I’ll have to deal with it because it is not responsive and, as such, it doesn’t work well in small screens which is a big problem.
Any critics and suggestions are welcome.
Greetings from Abapinho.