Google Search Console Verification with HTML File

Hi,

I found a solution for verification with Google Search Console via HTML-File. But I am wondering if there are more ways or even better ways to do that.

I found only an old post back then of Kirby 2 what described my problem. And a minimalistic answer I found with the issue #744 on GitHub. I just changed it a little bit. I was reading also about the HTTP Response in Kirby, but I didn’t get it completely.

My solution will be placed as route inside the config.php file

'routes' => [
  [
    'pattern' => 'google<yourId>.html',
    'action'  => function() {
       $html = 'google-site-verification: google<yourId>.html';   //the content of googles html file
       echo $html;
       }
  ],
],

And with the url <yourDomain.abc>/google<yourId>.html I get the correct file. The Search-Console is accepting that.

Any better ways to do that?

best regards
ET

I’d return an empty response:

      [
            'pattern' => 'google123456.html',
            'action'  => function() {
                return new Kirby\Http\Response('', 'text/html', 200);
               }
        ],
1 Like