Why Lektor?
Published: 2020-05-13 09:12:21

I wrote this article while prepping for my Outreachy internship. I was trying to find out why Lektor is being used for the project and found out really convincing reasons for the same.

Let’s start with basic types of website -

Static website: Here the webpages are pre-loaded to the server and when the request is made, these pages are served to the client as it is. These webpages can use HTML, CSS, and Javascript. By static, it does not mean that these webpages are devoid of user interactivity. These pages can be highly reactive (because of course JS) but yes they are not generated on the server and are static in that manner.

Dynamic website: Here the webpages are generated by the server. It is connected to a database and all the data is fetched from there. It uses server-side scripting and also client-side scripting (if necessary). It is called dynamic because the webpages are processed by the server.

So why go static? — Because the vast, vast majority of websites will be read many more times than they will be updated. This is crucial because dynamic content does not come for free. It needs server resources and because program code is running there it needs to be kept up to date for to ensure there are no security problems that are left unpatched. Also when a website gets a sudden spike of traffic a static website will stay up for longer on the same server than a dynamic one that needs to execute code.

There are certain drawbacks of static websites we are going to focus on here and how lektor helps us to combat those.

Drawbacks -

1. Multi-page websites are really hard to manage — Updating the content can be a cumbersome task here.

2. Lack of dynamic content.

3. Unavailability of the admin side of the website — This makes hard for non-technical people to edit the website.

Lektor helps to combat all the shortcomings listed above. It is built using Node.js and Python and is very easy to understand and use.

1. The first drawback has a very common solution that is templates. Lektor has a file structure that consists of — content, models, and templates. This structure helps us to manage multi-page websites without any cumbersome copy-pasting.
2. This drawback can be overcome by using external services or in house micro-services. These services can easily be integrated into your lektor project. This will save time and give efficient results.
3. This is the most amazing thing that Lektor does. Combating this shortcoming makes Lektor stand out. Lektor takes from content management systems like WordPress and provides a flexible browser-based admin interface from which you can edit your website’s contents. Unlike traditional CMS solutions, however, it runs entirely on your computer. This means you can give a Lektor website to people that have no understanding of programming and they can still modify the content and update the website.

Due to such capabilities, I find this framework amazing and I am excited about using it. Though there are many points untouched in this blog I would try to write a more in-depth blog when I learn about it more during my internship.

Credits — This blog is inspired by https://2016.ploneconf.org/talks/static-websites-with-lektor.html and also for more details you can check out https://www.getlektor.com/.