I updated and extended the snippet for Kirby 3, following @texnixeโs hints.
Therefore the file in Step 1 is as follows:
<?php
/* Kirby 3.x snippet: pagetitle.php
* last update 10.08.2019 by @HeinerEF (check, if user can read the page in the panel)
* update 09.08.2019 by @HeinerEF (using the hints from @texnixe at https://forum.getkirby.com/t/howto-working-with-contextual-links-to-the-panel/1566/9)
*/
$theTag = $theTag ?? 'h1'; // the tag for the page title via the snippet variable "theTag" assigned or 'h1'
// $theTagAddon // the e.g. "class-text" in the pagetitle tag via the snippet variable "theTagAddon" assigned (including 'class="..."')
$thePage = $thePage ?? $page; // the "$page" via the snippet variable "thePage" assigned
$thePageTitle = $thePageTitle ?? $thePage->title(); // the "$page->title()" via the snippet variable "thePageTitle" assigned
$thePageTitle = str_replace('</<wbr>', '</', str_replace('/', '/<wbr>', html($thePageTitle))); // add '<wbr>' after each '/' in the visible text of the title
// $thePageTitleAddon // the "Addon text" after the page title via the snippet variable "thePageTitleAddon" assigned
// $thePageLink // the url of the link in the title is in "thePageLink" or the variable "thePageLink" is empty for no link
?>
<<?= $theTag; ?><?php if (isset($theTagAddon)) echo ' ' .$theTagAddon; ?>><?php if (isset($thePageLink)) echo '<a href="' . $thePageLink . '">'; ?><?= $thePageTitle; ?><?php if (isset($thePageLink)) echo '</a>'; ?><?php if (isset($thePageTitleAddon)) echo $thePageTitleAddon; ?><?php if($user = kirby()->user() and $user->role()->permissions()->for('access', 'panel') and $thePage->permissions()->can('read')): // user is logged in and has panel access and can read the page in the panel ?><a href="<?= $thePage->panelUrl(); ?>" target="<?= option('HeinerEF.EditTarget', '_blank'); ?>" title="Edit page data (in new window / tab)" class="admineditlink"><sup class="fa fa-cog admincolor"></sup></a><?php endif; ?></<?= $theTag; ?>>
Good luck!
[last edited: 2019-08-10 21:15 / German time]