Hook between init and template

When writing a plugin and runnit it on init / directly the Kirby has not loaded all the template stuff, like $page.

Here is an issue:

http://forum.getkirby.com/t/functions-unable-to-load-the-page-object/1081/10

A plugin I made which forced me to user server variables

http://forum.getkirby.com/t/redirect-ending-slash-to-no-slash/1358

In my template

Right now in my testing environment I have this to solve the problem.

<?php do_before_template( $page ); ?>
<!DOCTYPE html>
<html>
<head>

I don’t think the function do_before_template() should need to be in my template at all.

Hook solution

To be able to do things with $page but before the template has loaded it would require something like a hook. In WordPress this is solved like this:

https://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect

I think Kirby perhaps can make it this good or better, especially a better and more general name for it, like “before_template” or something.

Thoughts?