# Draft preview opens in error

**URL:** <https://forum.getkirby.com/t/draft-preview-opens-in-error/33079>\
**Category:** Questions\
**Tags:** v4\
**Created:** [December 15, 2024, 1:48pm UTC](https://forum.getkirby.com/t/draft-preview-opens-in-error/33079 "2024-12-15T13:48:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![klotter](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/klotter/32/15012_2.png) [@klotter](https://forum.getkirby.com/u/klotter)\
**Post date:** [December 15, 2024, 1:48pm UTC](https://forum.getkirby.com/t/draft-preview-opens-in-error/33079/1 "2024-12-15T13:48:57Z")

</div>

when i route my website to exclude “works/” in the url, the draft preview sends me to the right link (siteurl/link without works?token=…) but it displays an error page. i don’t have that issue with pages that are not children of _works_.  
here is my routing:

```auto
'routes' => [
        [
            'pattern' => 'works/(:all)',
            'action' => function($uid) {
                go($uid);
            }
        ],
        [
            'pattern' => '(:all)',
            'action' => function($uid) {
                
                $page = page($uid);

                if(!$page) $page = page('works/' . $uid);
                if ($page) {
                  return site()->visit($page);
                }
               $this->next();
            }
        ],
    ],

```

i know this issue has come up before but i was not able to find a solution that worked for me.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [December 15, 2024, 2:39pm UTC](https://forum.getkirby.com/t/draft-preview-opens-in-error/33079/2 "2024-12-15T14:39:55Z")

</div>

> [@klotter](#):
>
> `page($uid);`

The `page()` helper does not fetch drafts, you need to use `kirby()->page($uid)` instead, see [page() | Kirby CMS](https://getkirby.com/docs/reference/templates/helpers/page)
