{% extends "includes/skeleton.html" %}

{% macro seo_title(content, config) -%}
    {{ content.get_meta('title') }} - {{ fp(config.site_name) }}
{%- endmacro %}

{% block head %}
<title>{{ seo_title(content, config) }}</title>
<meta name="author" content="{{ content.get_meta('author') }}" />
<meta name="description" content="{{ content.excerpt }}" />
<meta property="og:title" content="{{ seo_title(content, config) }}" />
<meta property="og:description" content="{{ content.excerpt }}" />
<meta property="og:site_name" content="{{ (config.site_name) }}" />
<meta property="og:type" content="article" />
<meta property="og:url" content="{{ Router.gen_permalink_by_content(content) }}" />
<meta property="og:image" content="{{ content.get_meta('banner') }}" />
<meta property="article:published_time" content="{{ content.get_meta('date') }}" />
<meta name="twitter:title" content="{{ seo_title(content, config) }}" />
<meta name="twitter:description" content="{{ content.excerpt }}" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:image" content="{{ content.get_meta('banner') }}" />
{% endblock head %}

{% block main %}
<main>    
    <section class="ga-section ga-content">
        <article class="yue">
            <h1 class="ga-post_title">{{ content.get_meta('title') }}</h1>
            <span class="ga-post_meta ga-mono">
                <span>{{ content.get_meta('author') }}</span>
                <time>
                    {{ content.get_meta('date').format("YYYY-MM-DD") }}
                </time>
                {% if len(content.get_meta('categories')) > 0 %}
                in <a no-style class="category" href="{{ Router.gen_permalink('category', content.get_meta('categories')[-1], 1) }}">
                    {{ content.get_meta('categories')[-1] }}
                </a>
                {% endif %}
                {% if config.valine['enable'] and config.valine.get('visitor', False) and content.get_meta('comment') %}
                <span class="leancloud_visitors" 
                    id="{{ get_path(Router.gen_permalink_by_content(content)) }}" 
                    data-flag-title="{{ content.meta['title'] }}"> · <i class="leancloud-visitors-count"></i> Views</span>
                {% endif %}
            </span>
            <div class="ga-content_body">
                {{ content.parsed }}
            </div>
        </article>
        {% block more_content %}{% endblock more_content %}
    </section>

    {% block more_section %}{% endblock more_section %}

    {% if config.valine['enable'] and content.get_meta('comment') %}
        <script>
            var initValine = function () {
                new Valine({{ json.dumps(config.valine) }});
            }
        </script>
        <script defer src='https://cdn.jsdelivr.net/npm/valine@1.3.10/dist/Valine.min.js' onload="initValine()"></script>
        <div id="vcomments"></div>
    {% endif %}

</main>
{% endblock main %}