All you have to do to add code to your head, is make your main extend.php file look something like the following. Here, I have my fav/app icons, as well as, I point to a javascript file for my analytics. This way I avoid having yet another extension for something simple like some code in the head.
<?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Flarum\Extend;
use Flarum\Frontend\Document;
return [
(new Extend\Frontend('forum'))
->content(function (Document $document) {
$document->head[] = '
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=rMqKBbNrwJ">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png?v=rMqKBbNrwJ">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png?v=rMqKBbNrwJ">
<link rel="manifest" href="/site.webmanifest?v=rMqKBbNrwJ">
<link rel="mask-icon" href="/safari-pinned-tab.svg?v=rMqKBbNrwJ" color="#2d2d2d">
<link rel="shortcut icon" href="/favicon.ico?v=rMqKBbNrwJ">
<meta name="apple-mobile-web-app-title" content="Ennuily">
<meta name="application-name" content="Ennuily">
<meta name="msapplication-TileColor" content="#000000">
<meta name="theme-color" content="#ffffff">
<script src="/analytics.js"></script>
';
})
];