<!DOCTYPE html>
<html lang="ja">
<head>
  <meta content="text/html; charset=utf-8" http-equiv="content-type" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <link rel="icon" href="/favicon.ico" id="favicon">
  <title>{{ SITEINFO['title'] }}: {{ $pagetit }}</title>
  <link rel="stylesheet" type="text/css" href="/static/style.css" />
{@ if (isset($custCss) && !empty($custCss) && !is_bool($custCss)) @}
{@ foreach ($custCss as $css) @}
  {{{ $css }}}
{@ endforeach @}
{@ endif @}
{@ if (isset($meta)) @}
{@ if (isset($meta->author)) @}
  <meta name="author" content="{{ $meta->author }}" />
{@ endif @}
{@ if (isset($meta->thumbnail)) @}
  <meta name="thumbnail" content="/static/{{ $meta->thumbnail }}" />
{@ endif @}
{@ endif @}
  <meta name="description" content="{{ $description }}" />
  <meta name="keywords" content="{{ SITEINFO['tags'].(isset($meta->category) ? ',' : '') }}{@ if (isset($meta) && isset($meta->category)) @}{@ foreach ($meta->category as $k => $cat) @}{{ $cat.($k === array_key_last($meta->category) ? '' : ',') }}{@ endforeach @}{@ endif @}" />

  <meta property="og:title" content="{{ SITEINFO['title'] }}: {{ $pagetit }}" />
  <meta property="og:description" content="{{ $description }}" />
  <meta property="og:type" content="{{ isset($meta) && isset($meta->thumbnail) ? 'article' : 'website' }}" />
  <meta property="og:url" content="{{ isset($_SERVER['REQUEST_URI']) ? 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] : 'https://'.$_SERVER['HTTP_HOST'] }}" />
{@ if (isset($meta) && isset($meta->thumbnail)) @}
  <meta property="og:image" content="https://{{ $_SERVER['HTTP_HOST'] }}/static/article/{{ $meta->thumbnail }}" />
{@ endif @}
  
{@ if (TWITTER_HANDLE != '') @}
  <meta name="twitter:card" content="summary_large_image" />
  <meta name="twitter:card" content="{{ TWITTER_HANDLE }}" />
  <meta name="twitter:title" content="{{ SITEINFO['title'] }}: {{ $pagetit }}" />
  <meta name="twitter:url" content="{{ isset($_SERVER['REQUEST_URI']) ? 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] : 'https://'.$_SERVER['HTTP_HOST'] }}" />
  <meta name="twitter:description" content="{{ $description }}" />
{@ if (isset($meta) && isset($meta->thumbnail)) @}
  <meta name="twitter:image:src" content="https://{{ $_SERVER['HTTP_HOST'] }}/static/article/{{ $meta->thumbnail }}" />
{@ endif @}
{@ endif @}
{@ if (ATOM_ENABLED) @}
  <link rel="alternate" type="application/atom+xml" title="{{ SITEINFO['title'] }} feed" href="/blog.atom" />
{@ endif @}
</head>
<body>
  <div class="container">
    <header>
      <div class="logo">
        {{ SITEINFO['title'] }}{{ "\n" }}
      </div>
      <nav>
{@ foreach ($menu as $m) @}
{@ if ($m['show']) @}
        <a class="{{ $m['class'] }}{{ $curPage == $m['page'] ? ' active' : '' }}" href="{{ $m['href'] }}">{{ $m['text'] }}</a>
{@ endif @}
{@ endforeach @}
{@ if (AUTH_ENABLED) @}
      <div>
{@ if (isset($user) && isset($user->id) && $user->id > 0) @}
        お帰りなしゃ～い、{{ $user->displayname ?? $user->username }}さん！ (<a href="/logout">ログアウト</a>)
{@ else @}
        <a href="/login">ログイン</a>
{@ if (AUTH_REGISTER_ENABLED) @}
        | <a href="/register">登録</a>
{@ endif @}
{@ endif @}
      </div>
{@ endif @}
      </nav>
    </header>
    <main>