[ [ 'pattern' => '(:all)/print', 'action' => function ($parentPath) { // Find parent page (the narrative) $parent = page($parentPath); if (!$parent || $parent->intendedTemplate()->name() !== 'narrative') { return $this->next(); } // Create virtual page with Page::factory() return Page::factory([ 'slug' => 'print', 'template' => 'print', 'parent' => $parent, 'content' => [ 'title' => 'Print - ' . $parent->title()->value(), 'uuid' => Uuid::generate() ] ]); } ] ] ]);