<!DOCTYPE html>
<html<%= config.language ? " lang=" + config.language.substring(0, 2) : ""%>>
<head>
    <meta charset="utf-8">
    <%
        function capitalize (str) { return str.charAt(0).toUpperCase() + str.substring(1).toLowerCase() }
        var title = page.title;
        if (is_archive()) {
            title = capitalize(__('index.archive'));
            if (is_month()) {
                title += ': ' + page.year + '/' + page.month;
            } else if (is_year()) {
                title += ': ' + page.year;
            }
        } else if (is_category()) {
            title = capitalize(__('index.category')) + ': ' + page.category;
        } else if (is_tag()) {
            title = capitalize(__('index.tag')) + ': ' + page.tag;
        }
    %>
    <title><% if (title) { %><%= title %> | <% } %><%= config.title %></title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <%- open_graph({
        image:          thumbnail(page),
        fb_app_id:      theme.miscellaneous.open_graph.fb_app_id,
        fb_admins:      theme.miscellaneous.open_graph.fb_admins,
        twitter_id:     theme.miscellaneous.open_graph.twitter_id,
        google_plus:    theme.miscellaneous.open_graph.google_plus,
    }) %>
    <%- meta(page) %>

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

    <% if (theme.customize.favicon) { %>
        <link rel="apple-touch-icon" sizes="57x57" href="/icons/apple-icon-57x57.png">
        <link rel="apple-touch-icon" sizes="60x60" href="/icons/apple-icon-60x60.png">
        <link rel="apple-touch-icon" sizes="72x72" href="/icons/apple-icon-72x72.png">
        <link rel="apple-touch-icon" sizes="76x76" href="/icons/apple-icon-76x76.png">
        <link rel="apple-touch-icon" sizes="114x114" href="/icons/apple-icon-114x114.png">
        <link rel="apple-touch-icon" sizes="120x120" href="/icons/apple-icon-120x120.png">
        <link rel="apple-touch-icon" sizes="144x144" href="/icons/apple-icon-144x144.png">
        <link rel="apple-touch-icon" sizes="152x152" href="/icons/apple-icon-152x152.png">
        <link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-icon-180x180.png">
        <link rel="icon" type="image/png" sizes="192x192"  href="/icons/android-icon-192x192.png">
        <link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png">
        <link rel="icon" type="image/png" sizes="96x96" href="/icons/favicon-96x96.png">
        <link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png">
        <link rel="manifest" href="/icons/manifest.json">
        <meta name="msapplication-TileColor" content="#ffffff">
        <meta name="msapplication-TileImage" content="/icons/ms-icon-144x144.png">
        <meta name="theme-color" content="#ffffff">
    <% } %>

    <%- css('vendor/font-awesome/css/font-awesome.min') %>
    <%- css('vendor/open-sans/styles') %>
    <%- css('vendor/source-code-pro/styles') %>

    <%- css('css/style') %>

    <%- js('vendor/jquery/2.1.3/jquery.min') %>
    <%- partial('plugin/scripts', { isHead: true }) %>
</head>
