advanced

Performance Tips and Optimization

Kiln is already fast, but here are tips to optimize your site further for speed and SEO.

Asset Namespace Optimization

Kiln's Asset Namespace feature organizes assets by content type and location:

assets/
                ├── content/
                │   ├── posts/
                │   │   └── my-post/
                │   │       └── diagram.png
                │   └── pages/
                │       └── about-logo.svg
                ├── shared/
                │   ├── fonts/
                │   └── icons/
                └── vendor/
                    └── scripts/
                

Assets are served at predictable URLs:

This structure:

Image Optimization

![Article banner](./my-image.webp)
                

CSS Performance

/* Minimize CSS specificity */
                .post-title { font-size: 2rem; }
                
                /* Use CSS variables for theming */
                :root {
                  --spacing-unit: 1rem;
                  --color-primary: #007acc;
                }
                
                /* Avoid @import in CSS (blocks rendering) */
                

Build Performance

# Fast rebuild for large sites
                kiln build --incremental
                
                # Parallel processing (default)
                kiln build --threads 8
                

Kiln automatically:

For monitoring:

kiln build --verbose  # Show timing per step
                

Caching Headers

Configure your web server for optimal caching:

# nginx example
                location /assets/ {
                  expires 1y;
                  add_header Cache-Control "public, immutable";
                }
                
                location /css/ {
                  expires 30d;
                  add_header Cache-Control "public";
                }
                
                location / {
                  expires 1h;
                  add_header Cache-Control "public";
                }
                

SEO Performance

Monitoring

Use lighthouse or similar tools:

# Google Lighthouse CLI
                lighthouse https://example.com --output=html
                

Focus on:

Content Best Practices

Performance is a feature. Make it a priority from the start!