DEV Community

Adriano Gil
Adriano Gil

Posted on

Blogging with Obsidian and Jekyll

Jekyll is a static site generator that transforms Markdown files into a fully functional website. Everything is generated into plain HTML, which makes it simple to deploy on platforms like GitHub Pages.

Writing in Obsidian

I use Obsidian for writing because:

  • It supports Markdown, making it easy to format posts.
  • I can organize posts with tags and metadata.
  • It keeps my writing centralized before publishing.

Each blog post has metadata that determines if it’s ready for publication. Drafts are excluded from processing.

Using Templates in Obsidian

To standardize my blog posts, I use templates in Obsidian. Templates help maintain consistency across different posts and speed up the writing process. So any time I want to start a new post I first create a planning note with brainstorming ideas and references. Then I create a post note which contains the full text and metadata for each post.

Using Dataview, an Obsidian plugin that allows me to query and display content dynamically based on metadata, I can track posts in different stages of completion, identify missing translations, and view related notes.

Jekyll-Multiple-Languages-Plugin

The jekyll-multiple-languages-plugin helps me to structure my content in multiple languages by creating different versions of each post. Here’s how it works:

  • My blog supports English, Portuguese, and French, configured in _config.yml:

    languages:
     - en
     - pt
     - fr
    default_lang: en
    
  • Each language has its own directory inside _i18n/, for example:

    _i18n/en/_posts/2025-02-01-my-post.md
    _i18n/pt/_posts/2025-02-01-meu-post.md
    
  • The plugin automatically generates language-specific URLs:

    https://adrianogil.github.io/blog/en/2025/02/my-post/
    https://adrianogil.github.io/blog/pt/2025/02/meu-post/
    
  • Users can switch languages using a simple language selector in the blog UI.

Automating the Blog Post Processing with Python

Manually copying Markdown files, managing assets, and handling metadata can be time-consuming. To ease my blogging process, I use a Python script that automates the following:

  • Extracting blog posts from my Obsidian vault.
  • Copying and processing images.
  • Formatting metadata for Jekyll.
  • Placing the final post in my blog’s GitHub Pages repository.

Fetching Notes

First, it gathers notes marked with a specific tag (GilLabs/posts/text).

notes = get_notes_from_index(target_tags=["GilLabs/posts/text"], as_obsidian_notes=True)
notes = [note for note in notes if not note.metadata.get("draft", True)]
Enter fullscreen mode Exit fullscreen mode

This ensures only published posts are processed.

Generating the Jekyll Blog Post File

Each post is formatted into Jekyll’s _posts structure with the correct date, language, and categories. Metadata such as title, layout, and categories are preserved.

---
categories: git
date: '2025-02-01 16:41:00 '
lang: en
lang-ref: intro-git
layout: post
title: "First Steps with Git"
updated: 2025-02-01T16:41
---
## Introduction
Hey there! I often find myself explaining Git from the ground up,...
Enter fullscreen mode Exit fullscreen mode

4. Deploying the Blog

Once the script updates the html files in my Jekyll project, I simply:

  1. Build the site with:
jekyll build
Enter fullscreen mode Exit fullscreen mode
  1. Push the changes to GitHub Pages with:
git add .
git commit -m "New blog post"
git push origin main
Enter fullscreen mode Exit fullscreen mode

Within minutes, my blog is live!

Top comments (0)