<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-port-a-jekyll-blog-theme-to-python-lessons-from-actually-doing-it-wuqwnl3vb" -->

---
title: How to Port a Jekyll Blog Theme to Python: Lessons From...
description: A developer walks through porting the tufte-jekyll blog theme (Ruby/Liquid-based static site generator) to a custom Python build system called tufte-python....
canonical: https://daily.dev/posts/how-to-port-a-jekyll-blog-theme-to-python-lessons-from-actually-doing-it-wuqwnl3vb
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How to Port a Jekyll Blog Theme to Python: Lessons From Actually Doing It | daily.dev
og:description: A developer walks through porting the tufte-jekyll blog theme (Ruby/Liquid-based static site generator) to a custom Python build system called tufte-python....
og:url: https://daily.dev/posts/how-to-port-a-jekyll-blog-theme-to-python-lessons-from-actually-doing-it-wuqwnl3vb
og:image: https://api.daily.dev/og/posts/WuqwNL3vb.png
og:image:alt: How to Port a Jekyll Blog Theme to Python: Lessons From Actually Doing It
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Port a Jekyll Blog Theme to Python: Lessons From Actually Doing It

**[freeCodeCamp](https://daily.dev/sources/freecodecamp)** · 22 min read · 0 upvotes · 0 comments

## Summary

A developer walks through porting the tufte-jekyll blog theme (Ruby/Liquid-based static site generator) to a custom Python build system called tufte-python. The write-up covers inventorying the original theme's moving parts, consolidating scattered YAML config into one file, reimplementing Jekyll's custom Liquid tags (sidenotes, margin notes, epigraphs) as a text preprocessing pass with regex and shlex, replacing compiled Sass with CSS custom properties for swappable themes, building an explicit modification-time cache to replace filesystem watching, and writing a custom GitHub Actions workflow since GitHub Pages can't natively build a Python project. It also details two real bugs encountered (apostrophe quoting breaking argument splitting, and shortcode regex firing inside code fences) and stresses testing against real existing posts rather than easy demo content.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.freecodecamp.org/news/how-to-build-a-reading-focused-blog-with-python-markdown-and-github-pages-for-free>

## Questions this post answers

### How do you convert Jekyll's custom Liquid tags like sidenotes into a Python static site generator?

Treat the Liquid tag syntax as plain text and expand it with a regex-based preprocessing pass over the raw Markdown before handing it to the Markdown renderer, mirroring Jekyll's own tag-then-Markdown order. A regex like {%\s*(\w+)\s*(.*?)\s*%} captures the tag name and arguments, shlex in POSIX mode splits quoted arguments correctly, and a HANDLERS dictionary maps tag names to Python functions returning HTML.

_daily.dev surfaces implementation patterns like this for developers building their own static site tooling._

### Why does my custom shortcode regex break markdown code blocks showing example tag syntax?

A tag-expansion regex designed to find patterns like {% ... %} anywhere in a document cannot distinguish live tags from example code inside fenced code blocks, so it replaces the example text with rendered HTML and breaks the layout. The fix is to stash fenced and inline code spans behind placeholders such as ##CODEBLOCK_1## before running the tag regex, then restore them afterward.

_Developers debugging shortcode or template regressions can track fixes like this via daily.dev._

### Why do only some pages get regenerated after I edit a shared template in a custom static site build cache?

A cache that only tracks each individual post's modification time will skip re-rendering pages whose source file did not change, even if a shared template they depend on did change, leaving stale HTML in the output. The fix is a separate global timestamp tracking the newest modification time across all build inputs (templates, config, generator source); if that timestamp is newer than the cache, force a full rebuild.

_daily.dev helps developers building custom build caches spot these incremental-rebuild pitfalls before shipping._

## Similar posts on daily.dev

- [Still blogging](https://daily.dev/posts/still-blogging-dvlzgt3or) · Pascal’s scribbles · 2 upvotes · 1 comments
- [Ruby Deserves Beautiful Documentation](https://daily.dev/posts/ruby-deserves-beautiful-documentation-x8ytgnn9g) · RUBYLAND · 14 upvotes · 0 comments
- [Quick tip: hosting HTML/CSS/JS demos from source code on GitHub Pages](https://daily.dev/posts/quick-tip-hosting-html-css-js-demos-from-source-code-on-github-pages-h9ycntnrq) · Christian Heilmann · 0 upvotes · 0 comments
- [Migrating from Jekyll to Hugo Part 3: Deployment and Lessons Learned](https://daily.dev/posts/migrating-from-jekyll-to-hugo-part-3-deployment-and-lessons-learned-emwk1gh4j) · We Are .NET · 0 upvotes · 0 comments

---

Tags: [#webdev](https://daily.dev/tags/webdev), [#python](https://daily.dev/tags/python), [#github-actions](https://daily.dev/tags/github-actions), [#github-pages](https://daily.dev/tags/github-pages)

[View this post on daily.dev](https://daily.dev/posts/how-to-port-a-jekyll-blog-theme-to-python-lessons-from-actually-doing-it-wuqwnl3vb)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How to Port a Jekyll Blog Theme to Python: Lessons From Actually Doing It","url":"https://daily.dev/posts/how-to-port-a-jekyll-blog-theme-to-python-lessons-from-actually-doing-it-wuqwnl3vb","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-port-a-jekyll-blog-theme-to-python-lessons-from-actually-doing-it-wuqwnl3vb"},"datePublished":"2026-09-22T02:18:04.773Z","dateModified":"2026-09-22T02:18:29.787Z","description":"A developer walks through porting the tufte-jekyll blog theme (Ruby/Liquid-based static site generator) to a custom Python build system called tufte-python....","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/37b81d50c0b9152fae9412824a0e6b3e?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/37b81d50c0b9152fae9412824a0e6b3e?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"freeCodeCamp","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"freeCodeCamp","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1628412854/logos/freecodecamp","url":"https://daily.dev/sources/freecodecamp"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-to-port-a-jekyll-blog-theme-to-python-lessons-from-actually-doing-it-wuqwnl3vb","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"webdev,python,github-actions,github-pages","timeRequired":"PT22M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"freeCodeCamp","item":"https://daily.dev/sources/freecodecamp"},{"@type":"ListItem","position":3,"name":"How to Port a Jekyll Blog Theme to Python: Lessons From Actually Doing It"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-to-port-a-jekyll-blog-theme-to-python-lessons-from-actually-doing-it-wuqwnl3vb#faq","mainEntity":[{"@type":"Question","name":"How do you convert Jekyll's custom Liquid tags like sidenotes into a Python static site generator?","acceptedAnswer":{"@type":"Answer","text":"Treat the Liquid tag syntax as plain text and expand it with a regex-based preprocessing pass over the raw Markdown before handing it to the Markdown renderer, mirroring Jekyll's own tag-then-Markdown order. A regex like {%\\s*(\\w+)\\s*(.*?)\\s*%} captures the tag name and arguments, shlex in POSIX mode splits quoted arguments correctly, and a HANDLERS dictionary maps tag names to Python functions returning HTML. daily.dev surfaces implementation patterns like this for developers building their own static site tooling."}},{"@type":"Question","name":"Why does my custom shortcode regex break markdown code blocks showing example tag syntax?","acceptedAnswer":{"@type":"Answer","text":"A tag-expansion regex designed to find patterns like {% ... %} anywhere in a document cannot distinguish live tags from example code inside fenced code blocks, so it replaces the example text with rendered HTML and breaks the layout. The fix is to stash fenced and inline code spans behind placeholders such as ##CODEBLOCK_1## before running the tag regex, then restore them afterward. Developers debugging shortcode or template regressions can track fixes like this via daily.dev."}},{"@type":"Question","name":"Why do only some pages get regenerated after I edit a shared template in a custom static site build cache?","acceptedAnswer":{"@type":"Answer","text":"A cache that only tracks each individual post's modification time will skip re-rendering pages whose source file did not change, even if a shared template they depend on did change, leaving stale HTML in the output. The fix is a separate global timestamp tracking the newest modification time across all build inputs (templates, config, generator source); if that timestamp is newer than the cache, force a full rebuild. daily.dev helps developers building custom build caches spot these incremental-rebuild pitfalls before shipping."}}]}
```

