> For the complete documentation index, see [llms.txt](https://www.one.thezero.club/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.one.thezero.club/guide/optimizing-your-website.md).

# Optimizing Your Website

Before making any changes, remember that performance is affected by many factors, including your hosting provider, images, third-party scripts, and website traffic. The recommendations below focus on the optimizations that usually provide the biggest improvements for Kirby websites.

***

### Enable Kirby Cache

One of the easiest ways to improve performance is to enable [Kirby's caching system](https://getkirby.com/docs/reference/system/options/cache).

Caching allows Kirby to store generated content and reuse it for future visitors, reducing the amount of work your server needs to do for every request.

#### Recommended Configuration

{% code title="site/config/config.your-domain.com.php" %}

```php
return [

    'cache' => [
        'pages' => true
    ],

    // The rest of your config options

];
```

{% endcode %}

For most websites, enabling page caching can significantly reduce page generation times and improve overall responsiveness.

{% hint style="info" %}
**Recommendation:** Enable caching on all production websites unless you have a specific reason not to.
{% endhint %}

***

### Optimize Thumbnail Quality

Images are often responsible for the majority of a page's loading time.

By slightly lowering the thumbnail quality, you can dramatically reduce image file sizes while maintaining excellent visual quality.

#### Recommended Configuration

{% code title="site/config/config.your-domain.com.php" %}

```php
return [

    'thumbs' => [
        'quality' => 80
    ],

    // The rest of your config options

];
```

{% endcode %}

#### Why 80?

For most websites, a quality setting of `80` provides an excellent balance between image quality and file size.

Visitors typically won't notice any visual difference, but image downloads can be considerably smaller.

{% hint style="info" %}
**Recommendation:** Values between 75 and 85 usually provide the best balance between visual quality and performance.
{% endhint %}

#### Built-in Image Size Limits

Zero One already helps optimize uploaded images by limiting their maximum dimensions through its image blueprints.

By default, uploaded images are automatically resized to fit within:

{% code title="site\plugins\zero-one\blueprints\files\image.yml" %}

```yaml
create:
  width: 2560
  height: 1980
  resize: true
```

{% endcode %}

This prevents unnecessarily large images from being stored and served by your website.

For most projects, these limits provide an excellent balance between quality and performance.

#### Customizing the Image Limits

If your project requires different image dimensions, you can override the default Zero One blueprints using the built-in Theme Override system.

The relevant blueprint files are:

```
site/plugins/zero-one/blueprints/files/image.yml
site/plugins/zero-one/blueprints/files/default.yml
```

Instead of modifying the theme files directly, create overrides as described in the [**Theme Extending Guide**](/guide/theme-extending.md).

{% hint style="warning" %}
**Important:** Avoid editing files inside the Zero One plugin directly. Customizations made there may be lost during future theme updates.
{% endhint %}

#### Should You Lower the Limits?

For image-heavy websites, reducing the maximum upload dimensions can significantly decrease storage usage and improve performance.

For example:

* Photography portfolios may benefit from larger dimensions.
* Business websites can often use smaller dimensions.
* Blogs and content-focused websites rarely need images larger than 1920px wide.

Always choose dimensions that match your actual design requirements rather than uploading the largest possible files.

#### Built-in Zero One Optimization

Zero One already includes several image optimization features out of the box:

* Uploaded images are automatically resized according to the image blueprint limitations.
* Images are served as modern WebP files by default.
* Kirby's thumbnail system generates appropriately sized image versions instead of serving original files.
* Images are lazy-loaded by default, meaning they are only loaded when they become visible to the visitor.

These optimizations help reduce bandwidth usage, improve page loading times, and lower the amount of data visitors need to download.

Combined with an optimized thumbnail quality setting, they provide an excellent performance foundation without requiring additional plugins or services.

***

### Enable Browser Caching

Browser caching allows visitors to store static assets such as images, fonts, CSS, and JavaScript files locally in their browser.

When users return to your website, these assets can often be loaded directly from their device instead of being downloaded again.

#### Example Apache Configuration

Add the following rules to your `.htaccess` file:

```apache
<IfModule mod_expires.c>

    ExpiresActive On

    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType image/webp "access plus 1 year"

    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"

</IfModule>
```

Example Nginx Configuration

```nginx
location ~* \.(jpg|jpeg|png|webp|gif|css|js|woff2)$ {
    expires 30d;
    add_header Cache-Control "public";
}
```

{% hint style="info" %}
**Important:** Browser caching is configured on your server, not in Kirby itself. Contact your hosting provider if you're unsure how to modify these settings.
{% endhint %}

***

### Reduce Third-Party Scripts

Many websites become slower because of external services rather than Kirby itself.

Examples include:

* Analytics tools
* Marketing platforms
* Chat widgets
* Social media embeds
* Tracking scripts

Every additional third-party script adds requests, processing time, and potential delays.

Before adding a new script, ask yourself whether its functionality justifies the performance cost.

{% hint style="info" %}
**Performance tip:** A simple website with fewer external dependencies is often faster than a heavily optimized website loaded with third-party integrations.
{% endhint %}

***

### Use Fast Hosting

A well-optimized website can still feel slow if it's running on poor hosting infrastructure.

When choosing a hosting provider, consider:

* PHP version support
* SSD or NVMe storage
* Server location
* Available resources
* Reputation and reliability

For most Kirby websites, hosting quality has a bigger impact than many advanced optimization techniques.

***

### Regularly Test Your Website

Performance should be monitored over time, especially after adding new features, plugins, or content.

Useful tools include:

* Google PageSpeed Insights
* GTmetrix
* WebPageTest

These tools can help identify bottlenecks and reveal opportunities for further optimization.

***

### Performance Is an Ongoing Process

There is rarely a single setting that makes a website fast. Good performance comes from many small improvements working together.

For the majority of Zero One websites, the biggest gains usually come from:

* Enabling Kirby cache
* Reducing image sizes
* Configuring browser caching
* Limiting third-party scripts
* Using reliable hosting

Combined, these optimizations can dramatically improve loading times and create a faster, more enjoyable experience for your visitors.
