I tend to get excited when I explore something new and I've gotten into the habit of making this website the focus of a new obsession.
When I first wrote this website, it was with the brand new HTML/CSS/JavaScript skills that I had learned. Then I learned Python and re-wrote this website to be more dynamic with the use of Flask. Months later I started learning reactive JavaScript front-ends and ended up re-working my porfolio into a single-page React application. I was mostly happy with it at that point, but I felt like I was still missing a couple of things.
I wanted a blog and didn't want to write one in JSX or do some sort of hacky markup rendering. The SEO wasn't quite up to snuff and I wanted something that would render really well in older/less accessible browsers. I also wanted something low maintenance and felt like React may have been overkill for a portfolio or a blog. Needless to say, it's easy to get carried away with new things.
Static site generators are fast, simple and secure
I had heard about static site generators while reading about them on Twitter and Mastodon. It ocurred to me that that static sites in general are wonderful and there are many reasons to use a static site generator:
- They provide content management (like WordPress), but without any of the bloat.
- They make it easy to write pages and posts in simple document formats (like Markdown).
- They generate very secure websites. It's just static content. There are no databases or backends to exploit outside of the web server itself.
After reading a few articles about the various static site generators out there, I decided to go with Pelican for a few reasons. Pelican is very mature, written in Python , highly customizable/configurable and has many features included. For example, it generates pages based on category, date, author and tag. You can also leverage custom post/page metadata and pass it to jinja powered templates that are very clear and easy to reason with. To deploy them, all you need is FTP or shell access to a shared host provider. You could also easily deploy a static website for free using something like Netlify or Github Pages.
To boot, there are dozens of plugins for Pelican. Since I enjoy Python, it wasn't all that challenging for me to write my own plugin for a niche situation like my VueJS powered comment system.
Pelican is also really well documented. This came in super handy while figuring out how to properly write a new theme and create special page templates like my home page and my portfolio category page.
The only drawback that I can think of is that Python is slower than some of the newer static site generators like Hugo. That being said, I'm still able to render this website in under half a second, and that's fast enough for me.
I'm super happy with what I've created with Pelican and am excited to share some of the tips & tricks I learned along the way. I don't think I'll be switching my website up any time soon.
Top comments (0)