KevsRobots Learning Platform

Mastering Markdown for Documentation with Jekyll

90% Percent Complete

Building and Testing Your Site Locally

Learn how to build your Jekyll site locally, test it for errors, and ensure it's ready for deployment, maintaining high quality and reliability.

By Kevin McAleer,    2 Minutes


Building and Testing Your Site Locally cover image

Introduction

Before deploying your site to the public, it’s essential to build and test it locally. This process helps you catch and fix any issues, ensuring your site operates correctly and provides a good user experience.

Building Your Site Locally

Jekyll comes with a built-in development server that regenerates your site every time a file is updated, making it easy to see changes in real-time.

  1. Start the Development Server: Open your terminal, navigate to your Jekyll project directory, and run:
    bundle exec jekyll serve
    
  2. Access Your Site: By default, your site will be available at http://localhost:4000. Open this address in your web browser to see your Jekyll site in action.

Testing for Errors

As you develop your site, you may encounter various errors, such as broken links, missing images, or layout issues. Here’s how to spot and fix common problems:

  • Check the Terminal Output: Jekyll prints errors and warnings to the terminal. Pay attention to these messages as they can provide clues on what needs fixing.
  • Use Browser Developer Tools: Modern browsers come with developer tools that can help diagnose issues with HTML, CSS, and JavaScript.

Enhancing Your Site’s Performance

Performance is key to providing a good user experience. Here are a few tips to improve your site’s speed:

  • Optimize Images: Ensure your images are appropriately sized and consider using compression tools to reduce their file size without significantly affecting quality.
  • Minimize CSS and JavaScript: Use tools to minify your CSS and JavaScript files, reducing their size and load times.

Practice Exercise

  1. Build your Jekyll site locally and navigate through each page to ensure everything loads correctly.
  2. Identify and fix any errors or warnings reported by Jekyll or discovered during your review.
  3. Optimize at least one image and one CSS file to improve your site’s performance.

Additional Resources


< Previous Next >