build-and-test.md 2.2 KB


title: "Build and Test Guide" date: 2024-04-10 draft: false

description: "Instructions for building and testing the blog before publishing"

Build and Test Guide

This guide provides step-by-step instructions for building and testing the blog before publishing changes.

Prerequisites

  • Hugo installed on your system
  • Git for version control
  • A modern web browser for testing

Development Workflow

1. Local Development

To start the development server:

hugo server -D

This will:

  • Start a local server (usually at http://localhost:1313)
  • Enable draft content viewing
  • Watch for file changes and auto-reload

2. Building the Site

To build the site for production:

hugo

This will:

  • Generate the static site in the public/ directory
  • Exclude draft content
  • Optimize assets

3. Testing Checklist

Before publishing, ensure you:

  1. Run the development server and check:

    • All pages load correctly
    • Links work as expected
    • Images display properly
    • Responsive design works on different screen sizes
  2. Build the site and verify:

    • No build errors in the console
    • All assets are generated correctly
    • The public/ directory contains all necessary files
  3. Content review:

    • Check for typos and grammar
    • Verify formatting is consistent
    • Ensure all images have alt text
    • Test all interactive elements

4. Publishing

After testing:

  1. Commit your changes:

    git add .
    git commit -m "Your descriptive commit message"
    
  2. Push to your repository:

    git push
    
  3. If using a CI/CD pipeline, verify the deployment was successful

Troubleshooting

Common issues and solutions:

  • Build errors: Check Hugo version compatibility and theme requirements
  • Missing content: Verify front matter is correct and content is in the right directory
  • Broken links: Use hugo server to test all internal links
  • Image issues: Check file paths and ensure images are in the correct directory

Additional Resources