{% extends "layout.html" %}

{% block page_title %}
    {{ post.title }} | {{ super() }}
{% endblock %}

{% block body %}

    <body id="post" {% if post.header_image %}class="feature"{% endif %}>
        {% include "includes/nav.html" %}

        {% if post.header_image %}
        <div class="entry-header">
            <div class="entry-image">
                <img src="{{ post.header_image }}">
            </div>

            <div class="image-credit">
                Image source: {{ post.header_caption }}
            </div>
        </div>
        {% endif %}

        <div id="main" role="main">
            <article class="hentry">
                <header class="header-title">
                    <div class="header-title-wrap">
                        <h1 class="entry-title"><a href="">{{ post.title }}</a></h1>
                        <h2>{{ (post.posted or now()).strftime("%B %d, %Y") }}</h2>
                    </div>
                </header>
                <div class="entry-content">
                    {{ post.rendered_content()|safe }}
                    <footer class="entry-meta">
                        <span class="entry-tags">
                            {% for tag in post.tags %}
                            <a href="" title="Pages tagged {{ tag }}" class="tag">{{ tag }}</a>
                            {% endfor %}
                        </span>

                        <span>
                            <a href="" rel="bookmark" title="{{ post.title }}">{{ post.title }}</a>
                            was published on
                            <span class="entry-date date published updated">
                                <time datetime="{{ (post.posted or now()).isoformat() }}">
                                    {{ (post.posted or now()).strftime("%B %d, %Y") }}
                                </time>
                            </span>
                        </span>

                        {% if post.modified %}
                            (revised:
                            <span class="entry-date date modified">
                                <time datetime="{{ post.modified.isoformat() }}">{{ post.modified.strftime("%B %d, %Y") }}</time>
                            </span>
                            )
                        {% endif %}

                        <div class="social-share">
                          <ul class="socialcount socialcount-small inline-list">
                            <li class="facebook"><a href="https://www.facebook.com/sharer/sharer.php?u={{ request.url|urlencode }}" title="Share on Facebook"><span class="count"><i class="fa fa-facebook-square"></i> Like</span></a></li>
                            <li class="twitter"><a href="https://twitter.com/intent/tweet?text={{ request.url|urlencode }}" title="Share on Twitter"><span class="count"><i class="fa fa-twitter-square"></i> Tweet</span></a></li>
                            <li class="googleplus"><a href="https://plus.google.com/share?url={{ request.url|urlencode }}" title="Share on Google Plus"><span class="count"><i class="fa fa-google-plus-square"></i> +1</span></a></li>
                          </ul>
                        </div>
                    </footer>
                </div>
                {% if config["DISQUS_SHORTNAME"] and not post.draft %}
                <div class="entry-content" id="disqus_thread">

                </div>
                {% endif %}
            </article>
        </div>
    </body>
{% endblock %}


{% block extra_scripts %}
    {% if config.DISQUS_SHORTNAME and not post.draft %}
        <script type="text/javascript">
            var disqus_shortname = '{{ config.DISQUS_SHORTNAME }}';
            var disqus_identifier = '{{ post.id }}';
            var disqus_url = '{{ url_for('view_post', slug=post.slug, _external=True) }}';

            /* * * DON'T EDIT BELOW THIS LINE * * */
            (function() {
                var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
                dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
                (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
            })();
        </script>
    {% endif %}
{% endblock %}