How I Migrated from Gatsby to Hugo with AI-Powered Development

• Hugo, Gatsby, Migration, Static Site Generators, AI Development, GitHub Copilot, DevOps • 9 min read

After years of maintaining my tech blog on Gatsby, I decided it was time for a change. The React-based complexity had grown cumbersome for what was essentially a content-focused site. Enter Hugo - the world’s fastest framework for building websites. But rather than tackle this migration alone, I leveraged Claude Sonnet through GitHub Copilot Agent Mode to automate much of the process. Here’s how it went.

The Problem with Gatsby

Don’t get me wrong - Gatsby is an excellent framework, and React remains my preferred frontend technology. But for a content-heavy blog with over 250 posts, the developer experience with Gatsby itself had become increasingly problematic:

  • Build times: What started as seconds had grown to 3-5 minutes as the number of blog posts increased
  • Development experience degradation: The time to compile and start publishing articles was becoming frustrating
  • Plugin ecosystem challenges: Difficulty finding well-maintained Gatsby plugins, often requiring npm install --legacy-peer-deps workarounds
  • Dependency management: Constant updates and security patches in the JavaScript ecosystem
  • GraphQL complexity: Overkill for simple content queries
  • Bundle size: Growing JavaScript footprint for what is essentially static content

The issue wasn’t with React - which I still love for interactive applications - but with Gatsby’s approach to static site generation at scale.

Why Hugo?

While my natural preference would be for a React-based solution, when analyzing alternative static site generators, Hugo caught my attention for several compelling reasons:

  • Speed: Sub-second build times even with hundreds of posts
  • Simplicity: No JavaScript runtime, pure static HTML generation
  • Content focus: Markdown-first approach with powerful templating
  • Deployment: Single binary with no dependencies
  • Developer experience: Fast iterations and immediate feedback during content creation

Hugo represented a pragmatic choice - trading some of React’s flexibility for dramatically improved build performance and developer experience for content-heavy sites.

The Migration Strategy

Rather than manually migrating everything, I decided to use AI assistance through GitHub Copilot’s new Agent Mode with Claude Sonnet. Here’s how the process unfolded:

Phase 1: Initial Setup and Configuration

The first step was setting up Hugo with the PaperMod theme and configuring it to match my existing site structure:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# hugo.toml
baseURL = "https://tech.playgokids.com"
languageCode = "en-us"
title = "Tech @ PlayGoKids"
theme = "PaperMod"

[params]
  env = "production"
  description = "Technical blog about .NET, Azure, and modern development practices"
  author = "Marcel Medina"
  
[menu]
  [[menu.main]]
    name = "Home"
    url = "/"
    weight = 10

AI Assistance: Claude helped generate the complete Hugo configuration, including:

  • Sitemap settings matching my existing structure
  • Permalink configuration to maintain URL compatibility
  • Taxonomy setup for tags and categories

Phase 2: Content Migration

The biggest challenge was migrating 250+ blog posts from Gatsby’s format to Hugo’s structure. Each post needed:

  1. Front matter conversion: From Gatsby’s GraphQL-friendly format to Hugo’s YAML
  2. Image path updates: Adjusting relative paths to work with Hugo’s asset pipeline
  3. Tag standardization: Consolidating the tagging system

AI Automation: Instead of manual work, Claude Sonnet generated sophisticated PowerShell scripts to speed up the migration process:

  • Batch convert front matter formats from Gatsby to Hugo YAML structure
  • Update image references and asset paths
  • Validate markdown syntax across all files
  • Apply consistent tagging and cleanup metadata
  • Remove obsolete Gatsby-specific configurations and imports

These PowerShell scripts transformed what would have been days of manual file editing into automated batch operations, significantly accelerating the migration timeline while ensuring consistency across all 250+ posts.

Phase 3: Design Matching

My Gatsby site had a custom design that needed to be replicated in Hugo. This involved:

Custom CSS Implementation

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* Matching original color scheme */
:root {
    --body-color: #515151;
    --malibu: #7ed5f9;
    --dark-blue: #263959;
    --matisse: #187f9f;
    --cerise: #e02c74;
}

/* Header styling to match original */
.header {
    background-color: var(--malibu) !important;
    position: fixed !important;
    top: 0;
    z-index: 1000;
}

/* Post styling matching Gatsby version */
.post-entry {
    background: var(--white) !important;
    border-bottom: 2px solid var(--seashell) !important;
    transition: all .3s ease !important;
}

AI Contribution: Claude analyzed the existing site’s CSS and automatically generated Hugo-compatible styles, including:

  • Color variable definitions
  • Layout responsiveness rules
  • Typography matching
  • Interactive hover effects

Phase 4: Advanced Features Implementation

Several advanced features needed special attention:

Syntax Highlighting

Hugo’s built-in Chroma was configured to match my existing code block styling:

1
2
3
4
[markup.highlight]
  style = "abyss"
  lineNos = true
  tabWidth = 2

Tag System Enhancement

The tag system needed custom templates to handle both tag clouds and individual tag pages:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
<!-- layouts/tags/list.html -->
{{ if .Data.Term }}
  <!-- Individual tag page -->
  <h1>Posts tagged with "{{ .Data.Term }}"</h1>
  {{ range .Pages }}
    <!-- Post listing -->
  {{ end }}
{{ else }}
  <!-- Tag cloud page -->
  {{ range .Site.Taxonomies.tags.ByCount }}
    <a href="{{ .Page.Permalink }}" class="tag">{{ .Page.Title }}</a>
  {{ end }}
{{ end }}

Mobile Optimization

Mobile responsiveness was crucial. AI helped implement:

  • Logo sizing for different screen sizes
  • Navigation hiding on mobile (Download, Contact, Tech links)
  • Touch-friendly interaction areas

Phase 5: Deployment Automation

The final piece was setting up automated deployment to Azure Static Web Apps:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# .github/workflows/deploy-hugo.yml
name: Deploy Hugo to Azure Static Web Apps

on:
  push:
    branches: [ main ]

jobs:
  build_and_deploy_job:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          submodules: true
          
      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: '0.152.2'
          extended: true

      - name: Build Hugo Site
        run: hugo --minify --gc --cleanDestinationDir
          
      - name: Deploy to Azure Static Web Apps
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
          action: "upload"
          app_location: "public"
          output_location: ""
          skip_app_build: true

Troubleshooting with AI

The migration wasn’t without challenges. Here are the key issues we encountered and how Claude helped resolve them:

Challenge 1: YAML Front Matter Corruption

Problem: During batch processing, some files lost their YAML delimiters, causing Hugo build failures.

AI Solution: Claude quickly identified the pattern and generated a script to:

  1. Scan all markdown files for missing --- delimiters
  2. Automatically repair the YAML structure
  3. Validate the fixes with Hugo’s parser

Challenge 2: Tag System Not Working

Problem: Individual tag pages weren’t displaying posts correctly.

AI Diagnosis: Claude analyzed the Hugo template system and identified that the conditional logic in layouts/tags/list.html wasn’t properly handling both tag cloud and individual tag views.

Solution: Implemented proper template conditionals using {{ if .Data.Term }} to differentiate between tag listing and individual tag pages.

Challenge 3: Azure Static Web Apps Deployment Failure

Problem: The deployment was failing with “Failed to find a default file in the app artifacts folder”.

AI Root Cause Analysis: Claude identified that the GitHub workflow was pointing to the wrong directory structure:

  • app_location: "/" was looking in the repository root
  • Hugo generates files in the public directory
  • Azure SWA couldn’t find index.html in the root

Fix: Updated the workflow to point directly to the Hugo output directory.

Challenge 4: Mobile Navigation Issues

Problem: The logo was getting squeezed on mobile devices with all navigation items visible.

AI Solution: Instead of resizing elements, Claude suggested hiding specific navigation items on mobile:

1
2
3
4
5
@media screen and (max-width: 768px) {
    .navbar-nav {
        display: none !important;
    }
}

The AI Development Experience

Using Claude Sonnet through GitHub Copilot Agent Mode transformed this migration from a multi-day manual effort into a streamlined, automated process. Key benefits:

1. Intelligent Problem-Solving

  • Claude didn’t just execute commands; it analyzed problems and proposed solutions
  • Pattern recognition helped identify issues before they became blockers
  • Contextual awareness meant solutions were tailored to the specific tech stack

2. Automated Code Generation

  • Bulk operations that would have taken hours were completed in minutes
  • Generated code followed best practices and conventions
  • Consistent styling and structure across all files

3. Real-Time Troubleshooting

  • Issues were diagnosed and fixed immediately as they arose
  • No need to research Hugo documentation or Stack Overflow
  • Solutions were explained, making the learning process efficient

4. Quality Assurance

  • Each step was validated before proceeding
  • Build processes were tested locally before deployment
  • Rollback strategies were considered for each major change

Performance Results

The migration delivered significant improvements:

MetricGatsby (Before)Hugo (After)Improvement
Build Time3-5 minutes15-30 seconds90% faster
Page Load2.1s0.8s62% faster
Bundle Size847KB234KB72% smaller
Lighthouse Score879813% better

Lessons Learned

This migration taught me several valuable lessons about modern development:

1. AI as a Development Partner

AI tools like Claude aren’t just code generators - they’re thinking partners that can analyze, strategize, and execute complex migrations with human oversight.

2. Simplicity Wins

Moving from a React-based SPA to static HTML reminded me that not every site needs JavaScript complexity. Sometimes, simpler is better.

3. Automated Testing is Essential

The AI’s ability to validate each step prevented many potential issues. Building validation into automated processes saves time and reduces errors.

4. Documentation Through Conversation

The conversational nature of AI assistance created a natural documentation trail. Each decision was explained and justified.

Future Improvements

The migration is complete, but there are always opportunities for enhancement:

  • Content optimization: AI-assisted SEO improvements
  • Performance monitoring: Automated Lighthouse testing in CI/CD
  • Content generation: AI assistance for technical writing
  • Advanced analytics: Hugo’s fast build times enable more sophisticated tracking

References

Official Documentation

Performance & Benchmarking

Migration Resources

Tools & Utilities

Community Resources

AI Development Tools

Conclusion

Migrating from Gatsby to Hugo with AI assistance proved that complex technical migrations don’t have to be painful, manual processes. By leveraging Claude Sonnet through GitHub Copilot Agent Mode, what could have been a week-long migration became a single day’s work with better results than manual execution.

The combination of Hugo’s performance and AI-powered development tools represents the future of web development - faster, simpler, and more reliable. If you’re considering a similar migration, I highly recommend exploring AI-assisted development tools. They don’t replace human judgment, but they amplify human capability in remarkable ways.

The modern development landscape is evolving rapidly, and tools like Claude Sonnet are making complex technical tasks more accessible than ever. Whether you’re migrating frameworks, building new features, or troubleshooting production issues, AI assistance can transform your development workflow.

Final stats: 250+ posts migrated, 0 data loss, 90% faster builds, and a much simpler maintenance workflow. Mission accomplished.

Comments & Discussion

Join the conversation! Share your thoughts and connect with other readers.