ideas
ideas copied to clipboard
Enable or disable preview depending of the page status
My suggestion is to have the possibility to enable or disable the preview depending of the page status. As a simple example who come in my mind at the moment: On the Kirby Demo, for the Agency Clients we can preview the clients list on the homepage, it should be nice if we can choose to not preview it if the client is on Archived or Upcomig status (draft and unlisted).
I just tried to use a page method to achieve this.
Because we can use the query language I expected this to work when returning false. It doesn't.
<?php
Kirby::plugin('my/methods', [
'pageMethods' => [
'anchorPreview' => function () {
if($this->isDraft()) {
return false;
}
else {
return $this->parent()->url() . '#' . $this->slug();
}
}
]
]);
title: Project Page
options:
preview: "{{ page.anchorPreview }}"
Adding support for a (false) boolean might be an easy solution for this.
Moved to https://kirby.nolt.io/35