Few fixes and reinstated the static caching.
Added included and excluded page types which can be added to the page query.
Bugfix with use of DB facade.
Parent page is conditional on it not being null, so by adding ->in(null) to a query you can query the entire page tree.
Added an isIndexable method to the page type, so certain pages can be ignored from the search.
Pass the page data to the main layout so the data can be used with the layout too. It has already been generated, so shouldn't add too much overhead.