--- title: Hello, Blog World! date: 2025-01-05 author: Josephine Pfeiffer tags: [blog, introduction, markdown, static-site, containers] description: The inaugural post for my new blog --- # Hello, Blog World! After years of publishing on various platforms, I've come full circle and set up a self-hosted blog again! This inaugural post explains why I made the switch and how I built this site. ## Why Medium Isn't Great for Readers Medium started with good intentions, but it's become increasingly hostile to readers. The constant nag walls asking for subscriptions interrupt the reading experience. Their aggressive email marketing tactics and the limited number of "free" articles create artificial scarcity for content that I want to be freely accessible. Even worse, Medium's reading experience has deteriorated with floating sidebars, sticky headers, and pop-ups that take up valuable screen real estate. The platform prioritizes its monetization strategy over reader comfort, resulting in slow page loads filled with tracking scripts and analytics. When readers visit a technical blog, they want the content -- not a battle with the UI. ## The Migration Migrating my blog was also a convenient chance to evaluate my existing content. Some posts have aged poorly and some simply don't meet my quality standards anymore. Each article that made it to this blog has been reviewed, updated where necessary, and deemed worthy of preservation. It's liberating to leave behind content that no longer serves its purpose and focus on what truly matters. ## The Technical Setup  Here's the simplified structure of my blog's repository: ``` . ├── Containerfile # Multi-stage container build definition ├── blog/ # Markdown content and templates │ ├── *.md # Blog posts in Markdown format │ ├── images/ # Images used in blog posts │ ├── index.html # Main blog index │ └── template.html # HTML template for post rendering ├── rss.xml # RSS feed for the blog └── scripts/ └── blog-build.sh # Markdown to HTML conversion script ``` ### Content-First Approach The foundation of this blog is straightforward: content is written in Markdown files, which are then converted to HTML using Pandoc. This approach keeps the focus on writing rather than wrestling with formatting. The separation of content from presentation means I can update the site's design without touching the articles themselves. Here's what a typical Markdown file looks like: ```markdown --- title: Hello, Blog World! date: 2025-01-05 author: Josephine Pfeiffer tags: [blog, introduction, markdown, static-site, containers] description: The inaugural post for my new blog --- # Hello, Blog World! After years of publishing on various platforms, I've come full circle... ``` Markdown strikes the perfect balance between readability in its raw form and flexibility for presentation. I can include code blocks with syntax highlighting, images with captions, and mathematical formulas when needed -- all without leaving the comfort of plain text. ### Multi-Stage Container Build I've set up a multi-stage Docker build that handles the conversion process efficiently: ```dockerfile # Stage 1: Builder container FROM fedora:latest AS builder # Install build dependencies RUN dnf install -y pandoc && dnf clean all # Copy source files to builder WORKDIR /build COPY . . # Run the blog build script to generate static HTML files RUN ./scripts/blog-build.sh # Stage 2: Runtime container FROM quay.io/fedora/httpd-24 # Copy only the generated files from the builder stage COPY --from=builder --chown=1001:0 /build /var/www/html/ # Configure Apache httpd settings (abbreviated) # ... ``` The build has two stages: 1. A builder stage that installs Pandoc and runs the build script 2. A runtime stage using a minimal Apache HTTPD image that serves the static files This approach results in a tiny production container that's secure and fast to deploy. ### The Build Script The blog-build.sh script handles the Markdown to HTML conversion: ```bash # Extract metadata from markdown file title=$(grep -m 1 "^title:" "$md_file" | sed 's/^title: *//') date=$(grep -m 1 "^date:" "$md_file" | sed 's/^date: *//') author=$(grep -m 1 "^author:" "$md_file" | sed 's/^author: *//') description=$(grep -m 1 "^description:" "$md_file" | sed 's/^description: *//') tags_line=$(grep -m 1 "^tags:" "$md_file" | sed 's/^tags: *//') # Use pandoc to convert Markdown to HTML pandoc -f markdown -t html --no-highlight "$md_file" > "$content_file" # Process images with captions cat "$final_content_file" | sed -E 's|