Skip to content

Commit

Permalink
Gracefully handle plugin responses
Browse files Browse the repository at this point in the history
Not every ID maps to an existing page, so in this case the URL is dynamically constructed.

Fixes #20.
  • Loading branch information
lukasbestle committed Mar 11, 2023
1 parent 0a9aca4 commit 26ca407
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/StatiCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Closure;
use Kirby\Cms\App;
use Kirby\Cms\Url;
use Kirby\Filesystem\F;
use Kirby\Filesystem\Mime;
use Kirby\Toolkit\Str;
Expand Down Expand Up @@ -104,7 +105,7 @@ protected function file(string|array $key): string
}

$page = $kirby->page($key['id']);
$url = $page->url($key['language']);
$url = $page?->url($key['language']) ?? Url::to($key['id']);

// content representation paths of the home page contain the home slug
if ($page->isHomePage() === true && $key['contentType'] !== 'html') {
Expand Down

0 comments on commit 26ca407

Please sign in to comment.