<?php if (isset($json) && $json != []) {
  $kirby->response()->type('application/json');
  header("Content-Type: application/json");
  echo json_encode($json);
  exit();
}?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>YGDC - <?= $title ?></title>
    <link rel="stylesheet" href="<?= asset("assets/css/style.min.css") ?>">
    <script type="importmap">
      {
        "imports": {
          "vue": "<?= asset("assets/js/vue.esm-browser.js") ?>"
        }
      }
    </script>
    <script>
      class InjectSVG extends HTMLElement {
        constructor() {
          super();
        }
        connectedCallback() {
          fetch(this.getAttribute('src'))
            .then(response => response.text())
            .then(text => {
              this.innerHTML = text;
            });
        }
      }
      customElements.define('inject-svg', InjectSVG);
    </script>
    <?php if ($site->url() == $page->url()): ?>
    <script type="text/javascript">
    if ('serviceWorker' in navigator) {
      navigator.serviceWorker.register('./sw.js');
    }
    </script>
    <?php endif; ?>
  </head>
