Skip to content

Commit 035855d

Browse files
committed
Fix parent page for virtual playground pages
1 parent e6d7115 commit 035855d

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

index.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,28 @@
3838
$this->next();
3939
}
4040

41-
$page = new Page([
42-
'slug' => $component ?? 'playground',
41+
$playgroundPage = new Page([
42+
'slug' => 'playground',
4343
'template' => 'playground',
4444
'content' => [
45-
'title' => $component ? "Playground: {$component}" : 'Playground',
46-
'component' => $component
45+
'title' => 'Playground'
4746
]
4847
]);
4948

50-
return site()->visit($page);
49+
if ($component) {
50+
$componentPage = new Page([
51+
'slug' => $component,
52+
'template' => 'playground',
53+
'parent' => $playgroundPage,
54+
'content' => [
55+
'title' => "Playground: {$component}",
56+
'component' => $component
57+
]
58+
]);
59+
return site()->visit($componentPage);
60+
} else {
61+
return site()->visit($playgroundPage);
62+
}
5163
}
5264
]
5365
]

0 commit comments

Comments
 (0)