Deploy on Netlify
Netlify is a popular platform for hosting static sites with continuous deployment. You connect your GitHub repository, and Netlify automatically builds and publishes your site every time you push a commit. Since Kiln is a standalone binary (not a standard Node.js package), you create a small build script that downloads and runs Kiln during each deployment.
This guide walks you through connecting your GitHub repository to Netlify so that every push automatically rebuilds and publishes your Obsidian vault as a website.
Prerequisites
- A GitHub repository containing your Obsidian vault.
- A Netlify account (the free Starter plan works fine for most documentation sites).
- No binary needed: You do not need to commit the
kilnbinary to your repository. The build script below downloads it automatically.
Step 1: Add a Build Script
Add a file named build.sh to the root of your repository. This script runs on Netlify's servers during each deployment to download Kiln and generate your static site.
#!/bin/bash
set -e
# 1. Download Kiln (Linux AMD64 binary for Netlify's build environment)
curl -L -o kiln https://github.com/otaleghani/kiln/releases/latest/download/kiln_linux_amd64
# 2. Make it executable
chmod +x kiln
# 3. Generate the site
./kiln generate \
--url "$URL" \
--name "My Digital Garden" \
--input "." \
--output "./public"
Netlify automatically provides the $URL environment variable during builds, so the script picks up the correct deployment URL without any extra configuration.
Customize the Build Flags
The Generate Command accepts several flags to control the output. The most important ones for deployment are:
| Flag | Example | Purpose |
|---|---|---|
--url | https://my-site.netlify.app | Sets the base URL for your [sitemap.xml](../Features/SEO/Sitemap xml.md), [robots.txt](../Features/SEO/Robots txt.md), and canonical tags |
--name | "My Digital Garden" | Sets the site name in [meta tags](../Features/SEO/Meta Tags.md) and the navigation bar |
--input | ./vault | Path to the folder containing your Markdown notes (defaults to ./vault) |
--output | ./public | Path where generated HTML files are saved (defaults to ./public) |
--theme | dracula | Color theme for your site — see [Themes & Visuals](../Features/User Interface/Themes.md) for all options |
--font | merriweather | Typography family — see [Fonts & Typography](../Features/User Interface/Fonts.md) for all options |
Step 2: Configure Environment Variables
Instead of hardcoding your production URL in the build script, you can use a Netlify environment variable. This keeps your script portable and makes it easy to use different URLs for preview and production deployments.
- In your Netlify site dashboard, go to Site configuration > Environment variables.
- Add a new variable:
| Name | Value | Scope |
|---|---|---|
URL | https://your-site.netlify.app | All deploys |
- Update your
build.shto reference it (already done in the script above):
./kiln generate --url "$URL"
If you prefer simplicity, you can hardcode the URL directly in the script instead:
./kiln generate --url "https://your-site.netlify.app"
Step 3: Configure Netlify
- Log in to Netlify and click "Add new site" > "Import an existing project".
- Select your GitHub repository.
- In the Build settings screen, configure the following:
| Setting | Value |
|---|---|
| Build Command | bash build.sh |
| Publish Directory | public |
- Click Deploy site.
Netlify will clone your repository, run build.sh (which downloads Kiln and generates the HTML), and publish the contents of the public folder to its global CDN.
Custom Domains
Netlify assigns a .netlify.app subdomain to every site by default. To use your own domain:
- Go to your site Domain management > Add a domain.
- Add your custom domain and follow the DNS configuration instructions.
- Update the
URLenvironment variable (or the hardcoded--urlflag) to match your custom domain so that your [sitemap.xml](../Features/SEO/Sitemap xml.md) and canonical links point to the correct address.
Troubleshooting
Build Fails with "Permission Denied"
Make sure the build.sh file is executable. You can fix this locally and commit:
chmod +x build.sh
git add build.sh
git commit -m "Make build script executable"
Broken CSS or Links
If your styles or internal links are broken after deployment, the --url flag is likely incorrect or missing. Kiln uses this value to generate absolute paths for assets and SEO files. Double-check that it matches your actual deployment URL (including https://).
Site Shows Stale Content
Netlify caches deployments at the CDN level. After updating your vault, push your changes to GitHub — Netlify will automatically trigger a new build. You can also trigger a manual redeploy from the Netlify dashboard under Deploys > Trigger deploy.
Other Hosting Options
Kiln generates standard HTML, CSS, and JavaScript that works on any static hosting platform. See the deployment guides for Cloudflare Pages, GitHub Pages, Vercel, or self-hosted Web Servers like Nginx, Apache, and Caddy.