tyrel.cloud


All posts tagged:


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:

  1. Something that supports markdown and syntax highlighting for code that I plan on posting
    • lektor-markdown-highlighter
  2. 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
  3. Something I can deploy to the cloud with low/no cost
    • Netlify is cheaper than EC2, S3, Cloudfrount, etc... !
  4. Something with high availability
    • Netlify's CDN is pretty fast and meets this availability requirement
  5. Something that will let me have 100% control of the layout and content
  6. 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

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:

  1. 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
  2. Create a Netlify Account netlify-log-in
  3. Attach our Netlify Account to the Git Repositiory netlify-attach-git
  4. Set up our Build Settings netlify_cd_settings

At this point your off to the races!

Within 3 days I have a workable solution!

Feel like I missed something? Let me know in the comments!