CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Repository Overview

This is a Quarto-based blog focused on data science, pharmacokinetic modeling, and R tutorials, authored by Granville Matheson. It was successfully migrated from Hugo/blogdown to Quarto in 2024 to fix rendering issues and modernize the tech stack.

Development Environment

  • Quarto: Primary static site generator
  • R: For executing code in posts and data analysis
  • GitHub Actions: Automated deployment pipeline

Common Commands

Local Development

# Preview the site locally with live reload
quarto preview

# Render the entire site
quarto render

# Check for issues
quarto check

# Clear cache if having rendering issues
quarto render --cache-refresh

Content Management

# Add new post (create in appropriate year directory)
mkdir -p posts/2024
touch posts/2024/new-post.qmd

# Add new section
mkdir new-section
touch new-section/index.qmd

Deployment

# Automatic deployment via GitHub Actions on push to master
git add .
git commit -m "Add new content"
git push origin master

Project Structure

  • _quarto.yml - Main configuration file with site settings, navigation, and formatting
  • index.qmd - Homepage with automatic post listings
  • about.qmd - About page content
  • posts/ - Blog posts organized by year:
    • 2018/ - 3 posts (Stockholm weather, reminder bot, self-portrait)
    • 2019/ - 2 posts (readability TED, r-bloggers)
    • 2020/ - 5 posts (kinfitr series, nonlinear modeling, text API)
    • index.qmd - Posts listing page with search and filtering
  • projects/ - Projects section (expandable for case studies)
  • papers/ - Academic papers section with publications list
  • images/ - Static images and assets
  • styles.css - Custom CSS styling for improved appearance
  • custom.scss - SCSS theme customization
  • .github/workflows/ - GitHub Actions deployment pipeline

Content Creation

Blog Posts

  1. Create .qmd file in posts/YYYY/ directory
  2. Add YAML frontmatter:
---
title: "Post Title"
author: "Granville Matheson"
date: "YYYY-MM-DD"
categories: ["Blog"]
tags: [R, Data Science]
description: "Brief description"
---
  1. Write content using Quarto markdown
  2. Preview locally, commit, and push

New Sections

  1. Create directory with index.qmd
  2. Update _quarto.yml navbar configuration
  3. Test navigation and deployment

Key Features

  • Math rendering: Uses KaTeX for LaTeX math
  • Code highlighting: Syntax highlighting for R and other languages
  • R code execution: Can execute R chunks during rendering
  • Search: Built-in site search functionality
  • Comments: Disqus integration for post comments
  • Analytics: Google Analytics tracking
  • RSS: Automatically generated feeds

Deployment Architecture

  • GitHub Actions workflow renders site automatically
  • GitHub Pages hosts the static site
  • R dependencies installed via GitHub Actions
  • Quarto handles rendering and optimization

Migration Notes (2024)

This blog was successfully migrated from Hugo/blogdown to Quarto to resolve: - Broken math rendering - Now uses KaTeX for reliable LaTeX math display - Missing R code syntax highlighting - Restored with proper themes and colors
- Outdated dependencies - Hugo/blogdown toolchain was breaking with updates - Complex deployment - Simplified with GitHub Actions automation

Migration preserved: - All 13 original blog posts (10 .Rmd + 3 .md files) - Publication list and about page content - Site structure and URLs for SEO - Disqus comments and Google Analytics integration

Troubleshooting

  • Build failures: Check GitHub Actions logs in repository Actions tab
  • Syntax errors: Use quarto check for validation
  • Rendering issues: Clear cache with quarto render --cache-refresh
  • Missing R packages: Add to .github/workflows/quarto-publish.yml dependencies
  • Math not displaying: Ensure using $$ for display math, $ for inline
  • Code highlighting broken: Check language specification in code blocks

Important Instructions

  • NEVER add eval=FALSE to any R code chunks in this repository - all code should execute properly with the correct dependencies installed