{{define "base"}}
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>{{if .Title}}{{.Title}} — {{end}}{{.AppName}}</title>
  <meta name="description" content="{{.Description}}">
  {{if .CanonicalURL}}<link rel="canonical" href="{{.CanonicalURL}}">{{end}}
  <meta name="robots" content="{{if .Robots}}{{.Robots}}{{else}}index,follow{{end}}">
  <meta name="generator" content="Warp Box {{.AppVersion}}">

  <meta property="og:site_name" content="{{.AppName}}">
  <meta property="og:type" content="{{if .OGType}}{{.OGType}}{{else}}website{{end}}">
  <meta property="og:title" content="{{if .Title}}{{.Title}}{{else}}{{.AppName}}{{end}}">
  <meta property="og:description" content="{{.Description}}">
  <meta property="og:url" content="{{if .CanonicalURL}}{{.CanonicalURL}}{{else}}{{.BaseURL}}{{end}}">
  {{if .ImageURL}}
  <meta property="og:image" content="{{.ImageURL}}">
  <meta property="og:image:secure_url" content="{{.ImageURL}}">
  {{if .ImageType}}<meta property="og:image:type" content="{{.ImageType}}">{{end}}
  <meta property="og:image:width" content="1200">
  <meta property="og:image:height" content="630">
  {{if .ImageAlt}}<meta property="og:image:alt" content="{{.ImageAlt}}">{{else}}<meta property="og:image:alt" content="{{.AppName}} preview">{{end}}
  {{end}}
  {{if .MediaURL}}
  {{if eq .OGType "video.other"}}
  <meta property="og:video" content="{{.MediaURL}}">
  <meta property="og:video:secure_url" content="{{.MediaURL}}">
  {{if .MediaType}}<meta property="og:video:type" content="{{.MediaType}}">{{end}}
  {{end}}
  {{if eq .OGType "music.song"}}
  <meta property="og:audio" content="{{.MediaURL}}">
  <meta property="og:audio:secure_url" content="{{.MediaURL}}">
  {{if .MediaType}}<meta property="og:audio:type" content="{{.MediaType}}">{{end}}
  {{end}}
  {{end}}

  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:title" content="{{if .Title}}{{.Title}}{{else}}{{.AppName}}{{end}}">
  <meta name="twitter:description" content="{{.Description}}">
  {{if .ImageURL}}
  <meta name="twitter:image" content="{{.ImageURL}}">
  {{if .ImageAlt}}<meta name="twitter:image:alt" content="{{.ImageAlt}}">{{else}}<meta name="twitter:image:alt" content="{{.AppName}} preview">{{end}}
  {{end}}

  <link rel="icon" href="/static/favicon.ico" sizes="any">
  <link rel="icon" type="image/png" sizes="16x16" href="/static/favicon-16x16.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/static/favicon-32x32.png">
  <link rel="apple-touch-icon" href="/static/apple-touch-icon.png">
  <link rel="manifest" href="/static/site.webmanifest">
  <meta name="theme-color" content="#8b5cf6">
  <meta name="msapplication-TileColor" content="#0b0b16">

  <script src="/static/js/05-theme.js?version={{.AppVersion}}"></script>
  <link rel="stylesheet" href="/static/css/00-base.css?version={{.AppVersion}}">
  <link rel="stylesheet" href="/static/css/10-layout.css?version={{.AppVersion}}">
  <link rel="stylesheet" href="/static/css/15-revamp.css?version={{.AppVersion}}">
  <link rel="stylesheet" href="/static/css/16-retro.css?version={{.AppVersion}}">
  <link rel="stylesheet" href="/static/css/17-gruvbox.css?version={{.AppVersion}}">
  <link rel="stylesheet" href="/static/css/18-cyberpunk.css?version={{.AppVersion}}">
  <link rel="stylesheet" href="/static/css/20-upload.css?version={{.AppVersion}}">
  <link rel="stylesheet" href="/static/css/30-download.css?version={{.AppVersion}}">
  <link rel="stylesheet" href="/static/css/40-docs.css?version={{.AppVersion}}">
  <link rel="stylesheet" href="/static/css/50-admin.css?version={{.AppVersion}}">
  <link rel="stylesheet" href="/static/css/60-storage.css?version={{.AppVersion}}">
  <link rel="stylesheet" href="/static/css/70-tokens.css?version={{.AppVersion}}">
  <link rel="stylesheet" href="/static/css/90-responsive.css?version={{.AppVersion}}">
  <script defer src="/static/js/00-utils.js?version={{.AppVersion}}"></script>
  <script defer src="/static/js/10-file-browser.js?version={{.AppVersion}}"></script>
  <script defer src="/static/js/12-reactions.js?version={{.AppVersion}}"></script>
  <script defer src="/static/js/20-storage-admin.js?version={{.AppVersion}}"></script>
  <script defer src="/static/js/25-admin-charts.js?version={{.AppVersion}}"></script>
  <script defer src="/static/js/30-token-copy.js?version={{.AppVersion}}"></script>
  <script defer src="/static/js/35-pagination.js?version={{.AppVersion}}"></script>
  <script defer src="/static/js/40-upload.js?version={{.AppVersion}}"></script>
  <script defer src="/static/js/45-preview.js?version={{.AppVersion}}"></script>
</head>
<body class="dark">
  <a class="skip-link" href="#main">Skip to content</a>
  <header class="site-header">
    <nav class="nav" aria-label="Main navigation">
      <a class="brand" href="/" aria-label="{{.AppName}} home">
        <span class="brand-mark" aria-hidden="true">W</span>
        <span>{{.AppName}}</span>
      </a>
      <div class="nav-links">
        {{if .CurrentUser}}
        <a class="button button-ghost" href="/app">Dashboard</a>
        {{if eq .CurrentUser.Role "admin"}}<a class="button button-ghost" href="/admin">Admin</a>{{end}}
        <a class="button button-ghost" href="/api">API</a>
        <a class="button button-outline" href="/account/settings"><span class="nav-username">{{.CurrentUser.Username}}</span></a>
        {{else}}
        <a class="button button-ghost" href="/api">API</a>
        <a class="button button-outline" href="/login">Sign in</a>
        {{end}}
      </div>
    </nav>
  </header>

  <main id="main">
    {{template "content" .}}
  </main>

  <footer class="site-footer">
    <span>{{.AppName}} · {{.AppVersion}} · {{.CurrentYear}}</span>
    <label class="theme-picker">
      <span>Theme</span>
      <select data-theme-select aria-label="Site theme">
        <option value="revamp">Aurora (default)</option>
        <option value="classic">Classic</option>
        <option value="retro">Web 1.0 (retro)</option>
        <option value="gruvbox">Gruvbox</option>
        <option value="cyberpunk">CyberPunk</option>
      </select>
    </label>
    <span class="footer-links">{{if .CurrentUser}}<a href="/app">Dashboard</a><a href="/api">API</a><a href="/account/settings">Account</a>{{else}}<a href="/login">Sign in</a><a href="/api">API</a>{{end}}</span>
  </footer>
</body>
</html>
{{end}}
