Blog log

This post will be constantly updated, but the date will not. So it won’t always be on top of new content. Here I’ll document my own blogging platform and knowledge decisions. A single point of blogging journey.

2022-09-23

The website was made using Jekyll one of open source static sites generator, and using my @piharpi’s simple theme, he called it klisé. The tool was convenient and I’d never worked with Ruby before, which was encouraging. Actually, choosing Jekyll was the best choice because it was supported for free in GitHub Pages. This would change soon, though.


We’ll start by creating a local development environment. I chose to install ruby and learned about the bundle command, somehow I expected a more straightforward process to use Gems and Tuby enviornment, but these libs usage is cryptic enough. I managed to finally spin up my devenv and open my site in localhost:4000.

I went through the Jekyll Step by Step tutorial to learn the sections of Jekyll, it was clear enough to start. Once I understood what layouts are, where the posts are created and how is this maintainable, I could start configuring some parts of the website. First, I needed to overrise any information that wasn’t about me. The /thanks webpage, the /about and others; also example posts. Very usefull all of them by the way.

I haven’t created a blog site before. But I’m following klisé’s advice to not use GitHub pages due to an image plugin, so https://vercel.app is the way to go. It seemed convenient enough, and I can easily create a subdomain to cover my blog from it. After deploying to Vercel, my site was finally live!

I am still defining my workflow, but I have found something sustainable. Post once a week, maintain a draft (staging) and prod environment so I can check live stuff before publishing and maintaining. Also, maintaining tags and posts structure is pretty straight forward.

How to run this project from scratch on Ubuntu:

$ git clone https://github.com/maravfe/blog my-blog
$ cd my-blog
$ sudo apt-get install ruby-full ruby-bundler build-essential
$ gem install jekyll bundler
$ bundle add webrick
$ bundle exec jekyll serve

Add a new post

  1. Create a folder inside _posts with the post name
  2. Create a file with format of YYYY-MM-DD-post-title.md.
  3. Add the front matter (header) below:
    ---
    layout: post
    title: "What is RSS feed?"
    date: 2022-09-21 23:50:20 -0600
    modified: 2022-09-22 18:21:20 -0600
    tags: [blogging, rss, tool]
    description: I learn and explain what is and how to use RSS Feeds
    excerpt: I learn and explain what is and how to use RSS Feeds
    ---
    
  4. Write the post content with Markdown format

Gitflow

  • I’ll be managing mainly 2 git branches for updates: main and draft.
  • Each of these will be accessible from blog.marcelloavila.com and draft.marcelloavila.com.
  • I should only commit to draft branch and merge through a PR within the UI.

2022-09-25

I’ll be implementing basic feature flags feature. To add a feature and flag it as non-prod, do: (remove spaces between { %)

{ %- if jekyll.environment != "production" %}
  <h1>This is a non-prod only feature</h1>
{ %- endif -%}

Then in Vercel, I create an environment variable for production deployment only with value JEKYLL_ENV=production


2022-09-30

Word count

Found this awesome post from sacha.me to easily add the word count in the post.html layout.

Cheat-sheet

Reference blogs

  1. Sneak
  2. Vext
  3. Nono

2022-10-08

Password protection for unpublished posts

Source. This method will add a password to draft posts, mostly. This is not highly secure, but it’s good enough to stop lurkers. Don’t spend your time brute-forcing my website. You’ll be successfull but will not find anything more interesting than the public posts. Done with Staticrypt.

In front matter, add locked: true variable:

---
layout: post
locked: true
[...]
---

This will add a lock next to the post name in home, archive pages and navigation tabs below each article. Also, the post suffix *-locked must be added for the make command to detect it needs to be encrypted. This can be improved in the future.

2022-MM-DD

WIP: Vercel deployment steps