# Secret Links of Draft Pages (improve the docs?)

**URL:** <https://forum.getkirby.com/t/secret-links-of-draft-pages-improve-the-docs/35593>\
**Category:** Questions\
**Tags:** v5\
**Created:** [September 4, 2026, 6:53am UTC](https://forum.getkirby.com/t/secret-links-of-draft-pages-improve-the-docs/35593 "2026-09-04T06:53:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cris](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/cris/32/14642_2.png) [@Cris](https://forum.getkirby.com/u/Cris)\
**Post date:** [September 4, 2026, 6:53am UTC](https://forum.getkirby.com/t/secret-links-of-draft-pages-improve-the-docs/35593/1 "2026-09-04T06:53:43Z")

</div>

I think, the documentation of secret links for draft pages has some room for improvements.

Nowhere are they mentioned but in this little [table cell](https://getkirby.com/docs/guide/content/publishing-workflow#page-states) and when opening `change status` of a page in the Panel, where the description says:

> The page is in draft mode and only visible for logged in editors or via secret link

It took me some while to figure out, how to get access to this link, in order to share it, which leads me to the next problem:  
`$page->previewUrl()` has been marked as [unstable](https://getkirby.com/docs/reference/objects/cms/page/preview-url).  
So, what is a stable approach to generate this link?

Additionally, I think it’s not very obvious, that a draft page can still be accessed without being logged into the panel, if the “secret link” contains a `_token` query. Yes, it’s probably unguessable, but IMO this should not be enabled by default and be configurable in the `config.php` (looking at you, evil crawlers!) and should be mentioned more explicitly somwhere in the docs.

So, my current workaround, in order to never let anyone access these pages, is a `route:before` hook, but this looks very ugly and I’m not sure, if this is the “smartest” way to implement it (appreciate any improvements).

```php
'route:before' => function(Route $route, string $path, string $method) {
				$kirby = App::instance();
				$page = $kirby->page($path);
				$user = $kirby->user();
				$token = get('_token');
				if($page
					&& (!$user || $user->role()->id() === 'visitor')
					&& $page->isDraft()
					&& $token
					// `kirby-locked-pages`-plugin specific.
					&& ($page->lockedPagesEnable()?->toBool() !== true
					|| $page->lockedPagesPassword()?->isEmpty())
				) {
					go('/');
				};

```

Thanks for reading! ☀
