Snowlake Jekyll documentation

Netlify Configuration Guide

This netlify.toml file provides configuration settings for deploying the Jekyll website on Netlify. It defines build processes, environment variables,…

Overview

This netlify.toml file provides configuration settings for deploying the Jekyll website on Netlify. It defines build processes, environment variables and security headers.

Build Configuration

Build Command

command = "bundle exec jekyll build"
  • Specifies the command to build the Jekyll site
  • Generates static files in the _site directory

Publish Directory

publish = "_site"
  • Defines the directory containing the generated static site
  • Netlify will serve files from this directory

Ruby Version

RUBY_VERSION = "3.4"
  • Sets the Ruby version for the build environment
  • Ensures compatibility with the project’s Ruby dependencies

Security Headers

The configuration includes several security headers to enhance website protection:

  • X-Frame-Options: DENY

    • Prevents the site from being embedded in iframes
    • Mitigates clickjacking attacks
  • X-XSS-Protection: 1; mode=block

    • Enables browser’s built-in XSS protection
    • Blocks detected XSS attacks
  • X-Content-Type-Options: nosniff

    • Prevents MIME type sniffing
    • Reduces the risk of malicious file execution
  • Referrer-Policy: strict-origin-when-cross-origin

    • Controls information sent in the Referer header
    • Enhances privacy and security

Missing Pages

Snowlake has no catch-all redirect. Netlify serves the theme’s 404.html with a real 404 status for any address that doesn’t exist, which is what search engines expect.

Versions before 2.2.0 had a /* → /index.html redirect. It sent every missing address to the home page, so search engines saw broken links as duplicate home pages. If you copied that file, remove the [[redirects]] block.

Environment-Specific Builds

Production Environment

[context.production.environment]
  JEKYLL_ENV = "production"
  • Sets Jekyll environment to “production”
  • Typically used for optimizations and excluding development-specific content

Deploy Previews and Branch Deployments

[context.deploy-preview]
  command = "bundle exec jekyll build --drafts --future"

[context.branch-deploy]
  command = "bundle exec jekyll build --drafts --future"
  • Builds site with drafts and future-dated posts
  • Useful for previewing changes before merging

Best Practices

  • Regularly review and update security headers
  • Ensure Ruby version matches project requirements
  • Use environment-specific builds for different deployment contexts