public function isValidExtension($extension)
    {
        $valid_page_types = implode('|', Grav::instance()['config']->get('system.pages.types'));

        // Strip the file extension for valid page types
        if (preg_match('/(' . $valid_page_types . ')/', $extension)) {
            return true;
        }
        return false;
    }