<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <%
  var title = page.title || '';

  if ( is_archive() ) {
    title = __('layout.blog');

    if ( is_month() ) {
      title += ': ' + page.year + '/' + page.month;
    } else if ( is_year() ) {
      title += ': ' + page.year;
    }

    if( page.current > 1 ) {
      title += ' ' + __('layout.page_n', page.current);
    }

  } else if ( is_category() ) {
    title = `${__('layout.category')}: ` + page.category;
  } else if ( is_tag() ) {
    title = `${__('layout.tag')}: ` + page.tag;
  }

  site.title = title;
  %>
  <title><% if (title){ %><%= title %> | <% } %><%= config.title %></title>

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta http-equiv="X-UA-Compatible" content="ie=edge" />

  <%- open_graph({
    twitter_id: getConfig('twitter'),
    google_plus: getConfig('google_plus'),
    fb_admins: getConfig('fb_admins'),
    fb_app_id: getConfig('fb_app_id')
  }); %>

  <% if (getConfig('rss')) { %>
    <link rel="alternate" href="<%- getConfig('rss') %>" title="<%= config.title %>" type="application/atom+xml" />
  <% } %>

  <%
  var favicon = getConfig('favicon');

  if ( favicon ) { %>
  <!--[if lte IE 10 ]><%- favicon_tag(favicon + '.ico') %><![endif]-->
  <!--[if !IE]><!-->
  <%- favicon_tag(favicon + '.png') %>

  <meta name="msapplication-TileImage" content="<%- url_for( favicon + '.png') %>"/>
  <meta name="msapplication-TileColor" content="#000000"/>

  <link rel="apple-touch-icon" href="<%- url_for('images/apple-touch-icon-57x57.png') %>" />
  <link rel="apple-touch-icon" sizes="72x72" href="<%- url_for('images/apple-touch-icon-72x72.png') %>" />
  <link rel="apple-touch-icon" sizes="114x114" href="<%- url_for('images/apple-touch-icon-114x114.png') %>" />
  <link rel="apple-touch-icon" sizes="144x144" href="<%- url_for('images/apple-touch-icon-144x144.png') %>" />

  <link rel="icon" sizes="256x256" href="<%- url_for( favicon + '.png' ) %>" />
  <!--<![endif]-->
  <% } %>

  <link href="https://fonts.googleapis.com/css?family=Source+Code+Pro|Material+Icons|Raleway:400,300,700" rel="stylesheet" type="text/css" />

  <!-- webpackAssetsInsert:css -->

  <%- partial('_partial/google-analytics') %>

  <script src="https://polyfill.io/v3/polyfill.min.js?features=es5,es6,es7,fetch,Object.entries,Object.values&flags=gated"></script>

</head>
<body>

  <%- partial('_partial/header', null, { cache: !config.relative_link }) %>

  <div id="main-container">
    <%- body %>
  </div>

  <footer class="page-footer grey darken-2">
    <div class="footer-copyright">
      <div class="container">
        &copy; <%= date(new Date(), 'YYYY') %> <%= config.author || config.title %>

        <div class="right">
          Powered by <a href="http://hexo.io/" rel="nofollow noopener" class="white-text" target="_blank">Hexo</a>
        </div>
      </div>
    </div>
  </footer>

  <!-- webpackAssetsInsert:js -->

</body>
</html>
