Skip to content

Static cache how to exclude class #8553

Answered by jasonvarga
earthwytch asked this question in Q&A
Discussion options

You must be logged in to vote

You can create a class that implements Statamic\StaticCaching\UrlExcluder then point to it there.

'exclude' => [
    'class' => \App\MyUrlExcluder::class,
],
<?php

namespace App;

use Statamic\StaticCaching\UrlExcluder;

class MyUrlExcluder implements UrlExcluder
{
    public function isExcluded(string $url): bool
    {
        // Your logic to figure out whether the url should be excluded.
    	return false;    
    }
}

That's how you'd use a custom class. However, I'm not sure how you'd be able to magically check "if the page has a form on it". 🤔

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@earthwytch
Comment options

@jasonvarga
Comment options

@earthwytch
Comment options

Answer selected by earthwytch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants