My Adventure with Lektor!
Updated by
Tyrel
on 2021-11-26
Summary
Blog made easy! Lektor is a static content management system (CMS) built on python.
Let the Journey Begin!
So why would I want to try out Lektor? Well let's see I wanted to create kind of a hobby site that is fairly easy to maintain. I was using Flask, Gunicorn, and NGINX on an EC2 Instance. Which is pretty cool but can feel like a third job :)
My Requirements:
- Something that supports markdown and syntax highlighting for
code
that I plan on posting
- lektor-markdown-highlighter
- Something I can troubleshoot fairly easily, and builds upon existing knowledge
- Lektor being based on python is cool, and I've done worked with Jinja templates before
- Something I can deploy to the cloud with low/no cost
- Netlify is cheaper than EC2, S3, Cloudfrount, etc... !
- Something with high availability
- Netlify's CDN is pretty fast and meets this availability requirement
- Something that will let me have 100% control of the layout and content
- Something that I can utilize with a CI/CD Pipeline for no hassle deployments!
- lektor > github > netlify
Here's how I got started
Installation:
$ curl -sf https://www.getlektor.com/installer.py | python3
Quickstart:
$ lektor quickstart
$ cd yourproject
$ lektor server
Enabling Markdown Highlighter:
Add the plugin
$ lektor plugins add markdown-highlighter
Create configs
folder under main project
$ mkdir configs
Within configs
folder create a file called markdown-highlighter.ini
$ nano configs/markdown-highlighter.ini
[pygments]
style = native
Create a pygments.css
file under assets/static/
$ touch assets/static/pygments.css
- This step might only be might only be needed for local development, as when I deploy to netlify this file is overwritten by the style defined in
markdown-highliter.ini
- I just put the exact same syntax for the style in this css file
At this point you should have a local development environment up and running
The next things we need to do in order to get the continuous integration and continuous deployment (CI/CD) pipeline going are:
- Creating a Git Repository
- even if we didn't wan to pipeline our deployments we would still want to have a backup of our
code
and our site
- Create a Netlify Account
- Attach our Netlify Account to the Git Repositiory
- Set up our Build Settings
At this point your off to the races!
Within 3 days I have a workable solution!